summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/BdsDxe
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-30 07:32:46 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-10-30 07:32:46 +0000
commit676df92c2c0c5bdeb0f8e27349f5dd467928ce09 (patch)
tree68999d69951d5884d39a206c5c81ba59d91157fb /MdeModulePkg/Universal/BdsDxe
parentbb1d8ee66943c3d126abbfc007159eb0fe458927 (diff)
downloadedk2-676df92c2c0c5bdeb0f8e27349f5dd467928ce09.zip
edk2-676df92c2c0c5bdeb0f8e27349f5dd467928ce09.tar.gz
edk2-676df92c2c0c5bdeb0f8e27349f5dd467928ce09.tar.bz2
Remove SafeFreePool from MemoryAllocationLib as this API's name is misleading. Its implementation only check if a pointer is NULL. If a garbage pointer is passed in, the gBS->FreePool will still ASSERT in debug build and return error code.
It is recommended that module writer should keep track how a pointer is allocated and free it after use. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6306 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/BdsDxe')
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c50
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c10
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c16
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c85
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c12
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c18
-rw-r--r--MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c37
7 files changed, 128 insertions, 100 deletions
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
index e11e279..9600074 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
@@ -324,7 +324,8 @@ BdsCreateLegacyBootOption (
Buffer
);
- SafeFreePool (Buffer);
+ FreePool (Buffer);
+
Buffer = NULL;
NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));
@@ -334,12 +335,11 @@ BdsCreateLegacyBootOption (
return EFI_OUT_OF_RESOURCES;
}
- if (NULL != *BootOrderList) {
+ if (*BootOrderList != NULL) {
CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize);
+ FreePool (*BootOrderList);
}
- SafeFreePool (*BootOrderList);
-
BootOrderLastIndex = (UINTN) (*BootOrderListSize / sizeof (UINT16));
NewBootOrderList[BootOrderLastIndex] = CurrentBootOptionNo;
*BootOrderListSize += sizeof (UINT16);
@@ -462,7 +462,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
&BootOptionSize
);
if (NULL == BootOptionVar) {
- SafeFreePool (BootOrder);
+ if (BootOrder != NULL) {
+ FreePool (BootOrder);
+ }
return EFI_OUT_OF_RESOURCES;
}
@@ -470,7 +472,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
// Skip Non-Legacy boot options
//
if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, &BbsIndex)) {
- SafeFreePool (BootOptionVar);
+ if (BootOptionVar!= NULL) {
+ FreePool (BootOptionVar);
+ }
Index++;
continue;
}
@@ -499,7 +503,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
continue;
}
- SafeFreePool (BootOptionVar);
+ if (BootOptionVar != NULL) {
+ FreePool (BootOptionVar);
+ }
//
// should delete
//
@@ -525,7 +531,9 @@ BdsDeleteAllInvalidLegacyBootOptions (
EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
}
- SafeFreePool (BootOrder);
+ if (BootOrder != NULL) {
+ FreePool (BootOrder);
+ }
return Status;
}
@@ -588,19 +596,19 @@ BdsFindLegacyBootOptionByDevType (
// Skip Non-legacy boot option
//
if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, BbsIndex)) {
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
continue;
}
if (BbsEntry->DeviceType != DevType) {
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
continue;
}
*Attribute = *(UINT32 *) BootOptionVar;
*OptionNumber = Index;
Found = TRUE;
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
break;
}
@@ -767,7 +775,7 @@ BdsAddNonExistingLegacyBootOptions (
}
if (BootOrder != NULL) {
- SafeFreePool (BootOrder);
+ FreePool (BootOrder);
}
return Status;
@@ -952,7 +960,7 @@ BdsCreateDevOrder (
TotalSize,
DevOrder
);
- SafeFreePool (DevOrder);
+ FreePool (DevOrder);
return Status;
}
@@ -1382,7 +1390,7 @@ BdsUpdateLegacyDevOrder (
}
}
- SafeFreePool (DevOrder);
+ FreePool (DevOrder);
Status = gRT->SetVariable (
VAR_LEGACY_DEV_ORDER,
@@ -1391,7 +1399,7 @@ BdsUpdateLegacyDevOrder (
TotalSize,
NewDevOrder
);
- SafeFreePool (NewDevOrder);
+ FreePool (NewDevOrder);
return Status;
}
@@ -1442,7 +1450,7 @@ BdsSetBootPriority4SameTypeDev (
}
if (DevOrder >= OrigBuffer + DevOrderSize) {
- SafeFreePool (OrigBuffer);
+ FreePool (OrigBuffer);
return EFI_NOT_FOUND;
}
@@ -1463,7 +1471,7 @@ BdsSetBootPriority4SameTypeDev (
}
}
- SafeFreePool (OrigBuffer);
+ FreePool (OrigBuffer);
return EFI_SUCCESS;
}
@@ -1619,7 +1627,7 @@ BdsRefreshBbsTableForBoot (
Ptr += StrSize ((UINT16 *) Ptr);
DevPath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
if (BBS_DEVICE_PATH != DevPath->Type || BBS_BBS_DP != DevPath->SubType) {
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
continue;
}
@@ -1628,7 +1636,7 @@ BdsRefreshBbsTableForBoot (
//
// We don't want to process twice for a device type
//
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
continue;
}
@@ -1637,14 +1645,14 @@ BdsRefreshBbsTableForBoot (
LocalBbsTable,
&Priority
);
- SafeFreePool (BootOptionVar);
+ FreePool (BootOptionVar);
if (EFI_ERROR (Status)) {
break;
}
}
if (BootOrder != NULL) {
- SafeFreePool (BootOrder);
+ FreePool (BootOrder);
}
//
// For debug
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
index 2e4b1c6..9ef2f7f 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
@@ -125,7 +125,9 @@ EfiGrowBuffer (
TryAgain = FALSE;
if (*Status == EFI_BUFFER_TOO_SMALL) {
- SafeFreePool (*Buffer);
+ if (*Buffer != NULL) {
+ FreePool (*Buffer);
+ }
*Buffer = AllocateZeroPool (BufferSize);
@@ -139,7 +141,7 @@ EfiGrowBuffer (
// If there's an error, free the buffer
//
if (!TryAgain && EFI_ERROR (*Status) && (*Buffer != NULL)) {
- SafeFreePool (*Buffer);
+ FreePool (*Buffer);
*Buffer = NULL;
}
@@ -201,7 +203,7 @@ EfiLibDeleteVariable (
//
Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);
ASSERT (!EFI_ERROR (Status));
- SafeFreePool (VarBuf);
+ FreePool (VarBuf);
}
return Status;
@@ -373,7 +375,7 @@ EfiReallocatePool (
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
}
- SafeFreePool (OldPool);
+ FreePool (OldPool);
}
return NewPool;
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
index fffcd68..ac31398 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -811,7 +811,7 @@ InitializeBM (
//
Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
if (Ptr == NULL) {
- SafeFreePool (BmmCallbackInfo);
+ FreePool (BmmCallbackInfo);
return EFI_OUT_OF_RESOURCES;
}
@@ -917,8 +917,8 @@ InitializeBM (
gUpdateData.BufferSize = UPDATE_DATA_SIZE;
gUpdateData.Data = AllocateZeroPool (UPDATE_DATA_SIZE);
if (gUpdateData.Data == NULL) {
- SafeFreePool (BmmCallbackInfo->LoadContext);
- SafeFreePool (BmmCallbackInfo);
+ FreePool (BmmCallbackInfo->LoadContext);
+ FreePool (BmmCallbackInfo);
return EFI_OUT_OF_RESOURCES;
}
@@ -1020,9 +1020,9 @@ InitializeBM (
FreeAllMenu ();
- SafeFreePool (BmmCallbackInfo->LoadContext);
- SafeFreePool (BmmCallbackInfo);
- SafeFreePool (gUpdateData.Data);
+ FreePool (BmmCallbackInfo->LoadContext);
+ FreePool (BmmCallbackInfo);
+ FreePool (gUpdateData.Data);
gUpdateData.Data = NULL;
return Status;
@@ -1205,7 +1205,7 @@ CleanUpStringDepository (
CurrentListNode = StringDepository->ListHead;
for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {
NextListNode = CurrentListNode->Next;
- SafeFreePool (CurrentListNode);
+ FreePool (CurrentListNode);
CurrentListNode = NextListNode;
}
@@ -1214,7 +1214,7 @@ CleanUpStringDepository (
//
// Release string depository.
//
- SafeFreePool (FileOptionStrDepository);
+ FreePool (FileOptionStrDepository);
}
/**
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
index 020d63a..85ba617 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
@@ -83,7 +83,7 @@ BOpt_CreateMenuEntry (
MenuEntry->VariableContext = AllocateZeroPool (ContextSize);
if (NULL == MenuEntry->VariableContext) {
- SafeFreePool (MenuEntry);
+ FreePool (MenuEntry);
return NULL;
}
@@ -116,59 +116,65 @@ BOpt_DestroyMenuEntry (
switch (MenuEntry->ContextSelection) {
case BM_LOAD_CONTEXT_SELECT:
LoadContext = (BM_LOAD_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LoadContext->FilePathList);
- SafeFreePool (LoadContext->LoadOption);
- SafeFreePool (LoadContext->OptionalData);
- SafeFreePool (LoadContext);
+ FreePool (LoadContext->FilePathList);
+ FreePool (LoadContext->LoadOption);
+ if (LoadContext->OptionalData != NULL) {
+ FreePool (LoadContext->OptionalData);
+ }
+ FreePool (LoadContext);
break;
case BM_FILE_CONTEXT_SELECT:
FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
if (!FileContext->IsRoot) {
- SafeFreePool (FileContext->DevicePath);
+ FreePool (FileContext->DevicePath);
} else {
if (FileContext->FHandle != NULL) {
FileContext->FHandle->Close (FileContext->FHandle);
}
}
- SafeFreePool (FileContext->FileName);
- SafeFreePool (FileContext->Info);
- SafeFreePool (FileContext);
+ if (FileContext->FileName != NULL) {
+ FreePool (FileContext->FileName);
+ }
+ if (FileContext->Info != NULL) {
+ FreePool (FileContext->Info);
+ }
+ FreePool (FileContext);
break;
case BM_CONSOLE_CONTEXT_SELECT:
ConsoleContext = (BM_CONSOLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (ConsoleContext->DevicePath);
- SafeFreePool (ConsoleContext);
+ FreePool (ConsoleContext->DevicePath);
+ FreePool (ConsoleContext);
break;
case BM_TERMINAL_CONTEXT_SELECT:
TerminalContext = (BM_TERMINAL_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (TerminalContext->DevicePath);
- SafeFreePool (TerminalContext);
+ FreePool (TerminalContext->DevicePath);
+ FreePool (TerminalContext);
break;
case BM_HANDLE_CONTEXT_SELECT:
HandleContext = (BM_HANDLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (HandleContext);
+ FreePool (HandleContext);
break;
case BM_LEGACY_DEV_CONTEXT_SELECT:
LegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LegacyDevContext);
+ FreePool (LegacyDevContext);
default:
break;
}
- SafeFreePool (MenuEntry->DisplayString);
+ FreePool (MenuEntry->DisplayString);
if (NULL != MenuEntry->HelpString) {
- SafeFreePool (MenuEntry->HelpString);
+ FreePool (MenuEntry->HelpString);
}
- SafeFreePool (MenuEntry);
+ FreePool (MenuEntry);
}
/**
@@ -278,7 +284,7 @@ BOpt_FindFileSystem (
if (BlkIo->Media->RemovableMedia) {
Buffer = AllocateZeroPool (BlkIo->Media->BlockSize);
if (NULL == Buffer) {
- SafeFreePool (BlkIoHandle);
+ FreePool (BlkIoHandle);
return EFI_OUT_OF_RESOURCES;
}
@@ -289,10 +295,10 @@ BOpt_FindFileSystem (
BlkIo->Media->BlockSize,
Buffer
);
- SafeFreePool (Buffer);
+ FreePool (Buffer);
}
}
- SafeFreePool (BlkIoHandle);
+ FreePool (BlkIoHandle);
}
//
@@ -332,7 +338,7 @@ BOpt_FindFileSystem (
//
MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
if (NULL == MenuEntry) {
- SafeFreePool (SimpleFsHandle);
+ FreePool (SimpleFsHandle);
return EFI_OUT_OF_RESOURCES;
}
@@ -390,7 +396,7 @@ BOpt_FindFileSystem (
}
if (NoSimpleFsHandles != 0) {
- SafeFreePool (SimpleFsHandle);
+ FreePool (SimpleFsHandle);
}
//
// Searching for handles that support Load File protocol
@@ -407,7 +413,7 @@ BOpt_FindFileSystem (
for (Index = 0; Index < NoLoadFileHandles; Index++) {
MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
if (NULL == MenuEntry) {
- SafeFreePool (LoadFileHandle);
+ FreePool (LoadFileHandle);
return EFI_OUT_OF_RESOURCES;
}
@@ -438,7 +444,7 @@ BOpt_FindFileSystem (
}
if (NoLoadFileHandles != 0) {
- SafeFreePool (LoadFileHandle);
+ FreePool (LoadFileHandle);
}
//
@@ -676,7 +682,7 @@ BOpt_FindFiles (
}
DirectoryMenu.MenuNumber = OptionNumber;
- SafeFreePool (DirInfo);
+ FreePool (DirInfo);
return EFI_SUCCESS;
}
@@ -898,7 +904,7 @@ BOpt_GetBootOptions (
if (BootNext != NULL) {
if (BootNextSize != sizeof (UINT16)) {
- SafeFreePool (BootNext);
+ FreePool (BootNext);
BootNext = NULL;
}
}
@@ -923,7 +929,7 @@ BOpt_GetBootOptions (
}
CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
- SafeFreePool (LoadOptionFromVar);
+ FreePool (LoadOptionFromVar);
if (BootNext != NULL) {
BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
@@ -932,7 +938,7 @@ BOpt_GetBootOptions (
}
if (0 == (*((UINT32 *) LoadOption) & LOAD_OPTION_ACTIVE)) {
- SafeFreePool (LoadOption);
+ FreePool (LoadOption);
continue;
}
//
@@ -1054,8 +1060,12 @@ BOpt_GetBootOptions (
MenuCount++;
}
- SafeFreePool (BootNext);
- SafeFreePool (BootOrderList);
+ if (BootNext != NULL) {
+ FreePool (BootNext);
+ }
+ if (BootOrderList != NULL) {
+ FreePool (BootOrderList);
+ }
BootOptionMenu.MenuNumber = MenuCount;
return MenuCount;
}
@@ -1318,7 +1328,7 @@ BOpt_FindDrivers (
NewMenuEntry = BOpt_CreateMenuEntry (BM_HANDLE_CONTEXT_SELECT);
if (NULL == NewMenuEntry) {
- SafeFreePool (DevicePathHandle);
+ FreePool (DevicePathHandle);
return EFI_OUT_OF_RESOURCES;
}
@@ -1332,7 +1342,10 @@ BOpt_FindDrivers (
InsertTailList (&DriverMenu.Head, &NewMenuEntry->Link);
}
- SafeFreePool (DevicePathHandle);
+
+ if (DevicePathHandle != NULL) {
+ FreePool (DevicePathHandle);
+ }
DriverMenu.MenuNumber = OptionNumber;
return EFI_SUCCESS;
@@ -1545,7 +1558,7 @@ BOpt_GetDriverOptions (
}
CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
- SafeFreePool (LoadOptionFromVar);
+ FreePool (LoadOptionFromVar);
NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
if (NULL == NewMenuEntry) {
@@ -1631,7 +1644,9 @@ BOpt_GetDriverOptions (
}
- SafeFreePool (DriverOrderList);
+ if (DriverOrderList != NULL) {
+ FreePool (DriverOrderList);
+ }
DriverOptionMenu.MenuNumber = Index;
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
index 635dc34..b9ffa05 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
@@ -419,7 +419,7 @@ LocateSerialIo (
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
if (NewMenuEntry == NULL) {
- SafeFreePool (Handles);
+ FreePool (Handles);
return EFI_OUT_OF_RESOURCES;
}
@@ -472,7 +472,9 @@ LocateSerialIo (
TerminalMenu.MenuNumber++;
}
}
- SafeFreePool (Handles);
+ if (Handles != NULL) {
+ FreePool (Handles);
+ }
//
// Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
@@ -515,7 +517,9 @@ LocateSerialIo (
NewTerminalContext->DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &Vendor
);
- SafeFreePool (NewMenuEntry->HelpString);
+ if (NewMenuEntry->HelpString != NULL) {
+ FreePool (NewMenuEntry->HelpString);
+ }
//
// NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
// NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
@@ -999,6 +1003,6 @@ GetConsoleOutMode (
}
}
}
+ FreePool (ModeInfo);
}
- SafeFreePool (ModeInfo);
}
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
index 3de4a0d..2ffb1ff 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
@@ -549,7 +549,7 @@ UpdateOrderPage (
);
}
- SafeFreePool (IfrOptionList);
+ FreePool (IfrOptionList);
UpdatePageEnd (CallbackData);
@@ -626,7 +626,7 @@ UpdateBootNextPage (
&gUpdateData
);
- SafeFreePool (IfrOptionList);
+ FreePool (IfrOptionList);
}
UpdatePageEnd (CallbackData);
@@ -771,8 +771,8 @@ UpdateConModePage (
ValidMode,
&gUpdateData
);
- SafeFreePool (IfrOptionList);
- SafeFreePool (ModeToken);
+ FreePool (IfrOptionList);
+ FreePool (ModeToken);
UpdatePageEnd (CallbackData);
}
@@ -946,7 +946,7 @@ UpdateTerminalPage (
&gUpdateData
);
- SafeFreePool (IfrOptionList);
+ FreePool (IfrOptionList);
UpdatePageEnd (CallbackData);
}
@@ -1063,14 +1063,14 @@ GetLegacyBootOptionVar (
(BBS_BBS_DP == DevicePath->SubType)
) {
*OptionIndex = OrderBuffer[Index];
- SafeFreePool (OrderBuffer);
+ FreePool (OrderBuffer);
return OptionBuffer;
} else {
- SafeFreePool (OptionBuffer);
+ FreePool (OptionBuffer);
}
}
- SafeFreePool (OrderBuffer);
+ FreePool (OrderBuffer);
return NULL;
}
@@ -1271,7 +1271,7 @@ UpdateSetLegacyDeviceOrderPage (
CopyMem (OldData, LegacyOrder, 100);
if (IfrOptionList != NULL) {
- SafeFreePool (IfrOptionList);
+ FreePool (IfrOptionList);
IfrOptionList = NULL;
}
diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c
index b97af5c..622093c 100644
--- a/MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c
+++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/Variable.c
@@ -122,7 +122,7 @@ Var_ChangeBootOrder (
//
if (BootOrderList != NULL) {
EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (BootOrderList);
+ FreePool (BootOrderList);
BootOrderList = NULL;
}
//
@@ -268,7 +268,7 @@ Var_ChangeDriverOrder (
//
if (DriverOrderList != NULL) {
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (DriverOrderList);
+ FreePool (DriverOrderList);
DriverOrderList = NULL;
}
@@ -407,7 +407,7 @@ Var_UpdateConsoleOption (
ConDevicePath = EfiLibGetVariable (ConsoleName, &gEfiGlobalVariableGuid);
if (ConDevicePath != NULL) {
EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);
- SafeFreePool (ConDevicePath);
+ FreePool (ConDevicePath);
ConDevicePath = NULL;
};
@@ -689,10 +689,11 @@ Var_UpdateDriverOption (
NewDriverOrderList
);
ASSERT_EFI_ERROR (Status);
- SafeFreePool (DriverOrderList);
+ if (DriverOrderList != NULL) {
+ FreePool (DriverOrderList);
+ }
DriverOrderList = NULL;
- SafeFreePool (NewDriverOrderList);
- NewDriverOrderList = NULL;
+ FreePool (NewDriverOrderList);
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
DriverOptionMenu.MenuNumber++;
@@ -849,6 +850,7 @@ Var_UpdateBootOption (
if (BootOrderList != NULL) {
EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
+ FreePool (BootOrderList);
}
Status = gRT->SetVariable (
@@ -860,9 +862,7 @@ Var_UpdateBootOption (
);
ASSERT_EFI_ERROR (Status);
- SafeFreePool (BootOrderList);
- BootOrderList = NULL;
- SafeFreePool (NewBootOrderList);
+ FreePool (NewBootOrderList);
NewBootOrderList = NULL;
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
BootOptionMenu.MenuNumber++;
@@ -976,6 +976,7 @@ Var_UpdateBootOrder (
//
if (BootOrderList != NULL) {
EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
+ FreePool (BootOrderList);
}
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
@@ -989,8 +990,7 @@ Var_UpdateBootOrder (
BootOrderListSize,
NewBootOrderList
);
- SafeFreePool (BootOrderList);
- SafeFreePool (NewBootOrderList);
+ FreePool (NewBootOrderList);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1048,6 +1048,7 @@ Var_UpdateDriverOrder (
//
if (DriverOrderList != NULL) {
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
+ FreePool (DriverOrderList);
}
for (Index = 0; Index < DriverOrderListSize; Index++) {
@@ -1065,8 +1066,6 @@ Var_UpdateDriverOrder (
return Status;
}
- SafeFreePool (DriverOrderList);
-
BOpt_FreeMenu (&DriverOptionMenu);
BOpt_GetDriverOptions (CallbackData);
return EFI_SUCCESS;
@@ -1190,13 +1189,13 @@ Var_UpdateBBSOption (
}
if (VarData >= VarData + VarSize) {
- SafeFreePool (OriginalPtr);
+ FreePool (OriginalPtr);
return EFI_NOT_FOUND;
}
NewOrder = (UINT16 *) AllocateZeroPool (DevOrder->Length - sizeof (UINT16));
if (NULL == NewOrder) {
- SafeFreePool (VarData);
+ FreePool (VarData);
return EFI_OUT_OF_RESOURCES;
}
@@ -1229,7 +1228,7 @@ Var_UpdateBBSOption (
NewOrder,
DevOrder->Length - sizeof (UINT16)
);
- SafeFreePool (NewOrder);
+ FreePool (NewOrder);
Status = gRT->SetVariable (
VAR_LEGACY_DEV_ORDER,
@@ -1239,7 +1238,7 @@ Var_UpdateBBSOption (
OriginalPtr
);
- SafeFreePool (OriginalPtr);
+ FreePool (OriginalPtr);
//
// Update Optional Data of Boot####
@@ -1371,8 +1370,8 @@ Var_UpdateBBSOption (
NewOptionPtr
);
- SafeFreePool (NewOptionPtr);
- SafeFreePool (BootOptionVar);
+ FreePool (NewOptionPtr);
+ FreePool (BootOptionVar);
}
BOpt_GetBootOptions (CallbackData);