]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SetVar.c
index 34eb6af8ac80c77051fbcd3420b71f0999ecd694..7c3aa542b43be4b7ec46bf6536e84eaa04954965 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for SetVar shell Debug1 function.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -49,7 +49,6 @@ ShellCommandRunSetVar (
   UINTN               Size;\r
   UINTN               LoopVar;\r
   EFI_DEVICE_PATH_PROTOCOL           *DevPath;\r
-  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *DevPathFromText;\r
 \r
   ShellStatus         = SHELL_SUCCESS;\r
   Status              = EFI_SUCCESS;\r
@@ -177,7 +176,9 @@ ShellCommandRunSetVar (
           if (Status == EFI_BUFFER_TOO_SMALL) {\r
             Buffer = AllocateZeroPool(Size);\r
             Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes2, &Size, Buffer);\r
-            FreePool(Buffer);\r
+            if (Buffer != NULL) {\r
+              FreePool(Buffer);\r
+            }\r
             Attributes = Attributes2;\r
           }          \r
           //\r
@@ -226,9 +227,7 @@ ShellCommandRunSetVar (
           //\r
           Data++;\r
           Data++;\r
-          Status = gBS->LocateProtocol(&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID**)&DevPathFromText);\r
-          ASSERT_EFI_ERROR(Status);\r
-          DevPath = DevPathFromText->ConvertTextToDevicePath(Data);\r
+          DevPath = ConvertTextToDevicePath(Data);\r
           if (DevPath == NULL) {\r
             ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, Status);\r
             ShellStatus = SHELL_INVALID_PARAMETER;\r