]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
Fix memory leak issues.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / BBSsupport.c
index 7879e18a4120b6d8abf388aee6baa88539f9f058..db0fed5834d512b415784f86e537d6f745ef131c 100644 (file)
@@ -76,6 +76,8 @@ OrderLegacyBootOption4SameType (
   *EnBootOptionCount  = 0;\r
   Index               = 0;\r
 \r
+  ASSERT (BbsIndexArray != NULL);\r
+  ASSERT (DeviceTypeArray != NULL);\r
   ASSERT (*EnBootOption != NULL);\r
   ASSERT (*DisBootOption != NULL);\r
 \r
@@ -84,7 +86,7 @@ OrderLegacyBootOption4SameType (
     UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);\r
     InitializeListHead (&List);\r
     BootOption = BdsLibVariableToOption (&List, OptionName);\r
-    ASSERT_EFI_ERROR (BootOption != NULL);\r
+    ASSERT (BootOption != NULL);\r
     \r
     if ((DevicePathType (BootOption->DevicePath) == BBS_DEVICE_PATH) &&\r
         (DevicePathSubType (BootOption->DevicePath) == BBS_BBS_DP)) {\r
@@ -111,6 +113,7 @@ OrderLegacyBootOption4SameType (
   //\r
   StartPosition = BootOrderSize / sizeof (UINT16);\r
   NewBootOption = AllocatePool (DevOrderCount * sizeof (UINT16));\r
+  ASSERT (NewBootOption != NULL);\r
   while (DevOrderCount-- != 0) {\r
     for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {\r
       if (BbsIndexArray[Index] == (DevOrder[DevOrderCount] & 0xFF)) {\r
@@ -191,7 +194,7 @@ GroupMultipleLegacyBootOption4SameType (
     UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);\r
     InitializeListHead (&List);\r
     BootOption = BdsLibVariableToOption (&List, OptionName);\r
-    ASSERT_EFI_ERROR (BootOption != NULL);\r
+    ASSERT (BootOption != NULL);\r
 \r
     if ((DevicePathType (BootOption->DevicePath) == BBS_DEVICE_PATH) &&\r
         (DevicePathSubType (BootOption->DevicePath) == BBS_BBS_DP)) {\r