]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/GenericBdsLib/BdsConsole.c
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its...
[mirror_edk2.git] / MdeModulePkg / Library / GenericBdsLib / BdsConsole.c
index dacc9c22d19eca8d47d6ba5e50c1d001acf1e511..376a3187be3f03dde6315b2ae1cd38f543f3618e 100644 (file)
@@ -126,7 +126,9 @@ BdsLibUpdateConsoleVariable (
       //\r
       TempNewDevicePath = NewDevicePath;\r
       NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);\r
-      SafeFreePool(TempNewDevicePath);\r
+      if (TempNewDevicePath != NULL) {\r
+        FreePool(TempNewDevicePath);\r
+      }\r
     }\r
   }\r
 \r
@@ -157,10 +159,16 @@ BdsLibUpdateConsoleVariable (
         );\r
 \r
   if (VarConsole == NewDevicePath) {\r
-    SafeFreePool(VarConsole);\r
+    if (VarConsole != NULL) {\r
+      FreePool(VarConsole);\r
+    }\r
   } else {\r
-    SafeFreePool(VarConsole);\r
-    SafeFreePool(NewDevicePath);\r
+    if (VarConsole != NULL) {\r
+      FreePool(VarConsole);\r
+    }\r
+    if (NewDevicePath) {\r
+      FreePool(NewDevicePath);\r
+    }\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -258,10 +266,10 @@ BdsLibConnectConsoleVariable (
         DeviceExist = TRUE;\r
       }\r
     }\r
-    SafeFreePool(Instance);\r
+    FreePool(Instance);\r
   } while (CopyOfDevicePath != NULL);\r
 \r
-  SafeFreePool (StartDevicePath);\r
+  FreePool (StartDevicePath);\r
 \r
   if (!DeviceExist) {\r
     return EFI_NOT_FOUND;\r
@@ -312,7 +320,10 @@ BdsLibConnectAllConsoles (
     BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);\r
   }\r
 \r
-  SafeFreePool(HandleBuffer);\r
+  if (HandleBuffer != NULL) {\r
+    FreePool(HandleBuffer);\r
+    HandleBuffer = NULL;\r
+  }\r
 \r
   gBS->LocateHandleBuffer (\r
           ByProtocol,\r
@@ -331,7 +342,9 @@ BdsLibConnectAllConsoles (
     BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);\r
   }\r
 \r
-  SafeFreePool(HandleBuffer);\r
+  if (HandleBuffer != NULL) {\r
+    FreePool(HandleBuffer);\r
+  }\r
 \r
   //\r
   // Connect all console variables\r