summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-02-24 09:03:22 +0800
committerFeng Tian <feng.tian@intel.com>2016-02-25 11:06:19 +0800
commit97033ebfa3cb10562c434a8927e2cba9e3940ec7 (patch)
tree6d7a77235c536fe9f9a5071e6a02949ac8f9f7b5 /MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
parentfed5f4475948fd09cb71ba4c9f3918af1c3a7ba6 (diff)
downloadedk2-97033ebfa3cb10562c434a8927e2cba9e3940ec7.tar.gz
edk2-97033ebfa3cb10562c434a8927e2cba9e3940ec7.tar.bz2
edk2-97033ebfa3cb10562c434a8927e2cba9e3940ec7.zip
MdeModulePkg: Fix the build fail issue on VS2008\VS2010\GCC
This is caused by my last commit,the LoadOption may not initialize when call FreePool, and after investigation, find that we can delete the LoadOption variable, this patch is to fix this issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c')
-rw-r--r--MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
index 5665d04088..0bd3170872 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
@@ -248,7 +248,6 @@ BOpt_GetBootOptions (
UINTN Index;
UINT16 BootString[10];
UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
UINTN BootOptionSize;
BOOLEAN BootNextFlag;
UINT16 *BootOrderList;
@@ -312,14 +311,6 @@ BOpt_GetBootOptions (
continue;
}
- LoadOption = AllocateZeroPool (BootOptionSize);
- if (LoadOption == NULL) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
- FreePool (LoadOptionFromVar);
-
if (BootNext != NULL) {
BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
} else {
@@ -331,8 +322,8 @@ BOpt_GetBootOptions (
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + BootOptionSize;
+ LoadOptionPtr = LoadOptionFromVar;
+ LoadOptionEnd = LoadOptionFromVar + BootOptionSize;
NewMenuEntry->OptionNumber = BootOrderList[Index];
NewLoadContext->Deleted = FALSE;
@@ -341,7 +332,7 @@ BOpt_GetBootOptions (
//
// Is a Legacy Device?
//
- Ptr = (UINT8 *) LoadOption;
+ Ptr = (UINT8 *) LoadOptionFromVar;
//
// Attribute = *(UINT32 *)Ptr;
@@ -423,6 +414,7 @@ BOpt_GetBootOptions (
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
MenuCount++;
+ FreePool (LoadOptionFromVar);
}
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
@@ -433,7 +425,6 @@ BOpt_GetBootOptions (
FreePool (BootOrderList);
}
- FreePool(LoadOption);
BootOptionMenu.MenuNumber = MenuCount;
return EFI_SUCCESS;
}
@@ -643,7 +634,6 @@ BOpt_GetDriverOptions (
UINTN Index;
UINT16 DriverString[12];
UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
UINTN DriverOptionSize;
UINT16 *DriverOrderList;
@@ -684,13 +674,6 @@ BOpt_GetDriverOptions (
continue;
}
- LoadOption = AllocateZeroPool (DriverOptionSize);
- if (LoadOption == NULL) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
- FreePool (LoadOptionFromVar);
NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
if (NULL == NewMenuEntry) {
@@ -698,8 +681,8 @@ BOpt_GetDriverOptions (
}
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + DriverOptionSize;
+ LoadOptionPtr = LoadOptionFromVar;
+ LoadOptionEnd = LoadOptionFromVar + DriverOptionSize;
NewMenuEntry->OptionNumber = DriverOrderList[Index];
NewLoadContext->Deleted = FALSE;
NewLoadContext->IsLegacy = FALSE;
@@ -761,13 +744,14 @@ BOpt_GetDriverOptions (
}
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
+ FreePool (LoadOptionFromVar);
}
if (DriverOrderList != NULL) {
FreePool (DriverOrderList);
}
- FreePool(LoadOption);
+
DriverOptionMenu.MenuNumber = Index;
return EFI_SUCCESS;