]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its...
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / BootMaint / BBSsupport.c
index e11e279247315b0f3b90734a0c67b6b3d5ecea2d..96000749c9efcff581f5eba66c8c6869d53bbd94 100644 (file)
@@ -324,7 +324,8 @@ BdsCreateLegacyBootOption (
                   Buffer\r
                   );\r
 \r
-  SafeFreePool (Buffer);\r
+  FreePool (Buffer);\r
+  \r
   Buffer = NULL;\r
 \r
   NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));\r
@@ -334,12 +335,11 @@ BdsCreateLegacyBootOption (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  if (NULL != *BootOrderList) {\r
+  if (*BootOrderList != NULL) {\r
     CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize);\r
+    FreePool (*BootOrderList);\r
   }\r
 \r
-  SafeFreePool (*BootOrderList);\r
-\r
   BootOrderLastIndex                    = (UINTN) (*BootOrderListSize / sizeof (UINT16));\r
   NewBootOrderList[BootOrderLastIndex]  = CurrentBootOptionNo;\r
   *BootOrderListSize += sizeof (UINT16);\r
@@ -462,7 +462,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
                       &BootOptionSize\r
                       );\r
     if (NULL == BootOptionVar) {\r
-      SafeFreePool (BootOrder);\r
+      if (BootOrder != NULL) {\r
+        FreePool (BootOrder);\r
+      }\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
   \r
@@ -470,7 +472,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
     // Skip Non-Legacy boot options\r
     // \r
     if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, &BbsIndex)) {\r
-      SafeFreePool (BootOptionVar);\r
+      if (BootOptionVar!= NULL) {\r
+        FreePool (BootOptionVar);\r
+      }\r
       Index++;\r
       continue;\r
     }\r
@@ -499,7 +503,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
       continue;\r
     }\r
 \r
-    SafeFreePool (BootOptionVar);\r
+    if (BootOptionVar != NULL) {\r
+      FreePool (BootOptionVar);\r
+    }\r
     //\r
     // should delete\r
     //\r
@@ -525,7 +531,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
     EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);\r
   }\r
 \r
-  SafeFreePool (BootOrder);\r
+  if (BootOrder != NULL) {\r
+    FreePool (BootOrder);\r
+  }\r
 \r
   return Status;\r
 }\r
@@ -588,19 +596,19 @@ BdsFindLegacyBootOptionByDevType (
     // Skip Non-legacy boot option\r
     //\r
     if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, BbsIndex)) {\r
-      SafeFreePool (BootOptionVar);\r
+      FreePool (BootOptionVar);\r
       continue;\r
     }\r
 \r
     if (BbsEntry->DeviceType != DevType) {\r
-      SafeFreePool (BootOptionVar);\r
+      FreePool (BootOptionVar);\r
       continue;\r
     }\r
 \r
     *Attribute    = *(UINT32 *) BootOptionVar;\r
     *OptionNumber = Index;\r
     Found         = TRUE;\r
-    SafeFreePool (BootOptionVar);\r
+    FreePool (BootOptionVar);\r
     break;\r
   }\r
 \r
@@ -767,7 +775,7 @@ BdsAddNonExistingLegacyBootOptions (
   }\r
 \r
   if (BootOrder != NULL) {\r
-    SafeFreePool (BootOrder);\r
+    FreePool (BootOrder);\r
   }\r
 \r
   return Status;\r
@@ -952,7 +960,7 @@ BdsCreateDevOrder (
                   TotalSize,\r
                   DevOrder\r
                   );\r
-  SafeFreePool (DevOrder);\r
+  FreePool (DevOrder);\r
 \r
   return Status;\r
 }\r
@@ -1382,7 +1390,7 @@ BdsUpdateLegacyDevOrder (
     }\r
   }\r
 \r
-  SafeFreePool (DevOrder);\r
+  FreePool (DevOrder);\r
 \r
   Status = gRT->SetVariable (\r
                   VAR_LEGACY_DEV_ORDER,\r
@@ -1391,7 +1399,7 @@ BdsUpdateLegacyDevOrder (
                   TotalSize,\r
                   NewDevOrder\r
                   );\r
-  SafeFreePool (NewDevOrder);\r
+  FreePool (NewDevOrder);\r
 \r
   return Status;\r
 }\r
@@ -1442,7 +1450,7 @@ BdsSetBootPriority4SameTypeDev (
   }\r
 \r
   if (DevOrder >= OrigBuffer + DevOrderSize) {\r
-    SafeFreePool (OrigBuffer);\r
+    FreePool (OrigBuffer);\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -1463,7 +1471,7 @@ BdsSetBootPriority4SameTypeDev (
     }\r
   }\r
 \r
-  SafeFreePool (OrigBuffer);\r
+  FreePool (OrigBuffer);\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1619,7 +1627,7 @@ BdsRefreshBbsTableForBoot (
     Ptr += StrSize ((UINT16 *) Ptr);\r
     DevPath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;\r
     if (BBS_DEVICE_PATH != DevPath->Type || BBS_BBS_DP != DevPath->SubType) {\r
-      SafeFreePool (BootOptionVar);\r
+      FreePool (BootOptionVar);\r
       continue;\r
     }\r
 \r
@@ -1628,7 +1636,7 @@ BdsRefreshBbsTableForBoot (
       //\r
       // We don't want to process twice for a device type\r
       //\r
-      SafeFreePool (BootOptionVar);\r
+      FreePool (BootOptionVar);\r
       continue;\r
     }\r
 \r
@@ -1637,14 +1645,14 @@ BdsRefreshBbsTableForBoot (
               LocalBbsTable,\r
               &Priority\r
               );\r
-    SafeFreePool (BootOptionVar);\r
+    FreePool (BootOptionVar);\r
     if (EFI_ERROR (Status)) {\r
       break;\r
     }\r
   }\r
 \r
   if (BootOrder != NULL) {\r
-    SafeFreePool (BootOrder);\r
+    FreePool (BootOrder);\r
   }\r
   //\r
   // For debug\r