mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-14 09:14:24 +02:00
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>
This commit is contained in:
parent
fed5f44759
commit
97033ebfa3
@ -248,7 +248,6 @@ BOpt_GetBootOptions (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT16 BootString[10];
|
UINT16 BootString[10];
|
||||||
UINT8 *LoadOptionFromVar;
|
UINT8 *LoadOptionFromVar;
|
||||||
UINT8 *LoadOption;
|
|
||||||
UINTN BootOptionSize;
|
UINTN BootOptionSize;
|
||||||
BOOLEAN BootNextFlag;
|
BOOLEAN BootNextFlag;
|
||||||
UINT16 *BootOrderList;
|
UINT16 *BootOrderList;
|
||||||
@ -312,14 +311,6 @@ BOpt_GetBootOptions (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadOption = AllocateZeroPool (BootOptionSize);
|
|
||||||
if (LoadOption == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
|
|
||||||
FreePool (LoadOptionFromVar);
|
|
||||||
|
|
||||||
if (BootNext != NULL) {
|
if (BootNext != NULL) {
|
||||||
BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
|
BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
|
||||||
} else {
|
} else {
|
||||||
@ -331,8 +322,8 @@ BOpt_GetBootOptions (
|
|||||||
|
|
||||||
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
|
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
|
||||||
|
|
||||||
LoadOptionPtr = LoadOption;
|
LoadOptionPtr = LoadOptionFromVar;
|
||||||
LoadOptionEnd = LoadOption + BootOptionSize;
|
LoadOptionEnd = LoadOptionFromVar + BootOptionSize;
|
||||||
|
|
||||||
NewMenuEntry->OptionNumber = BootOrderList[Index];
|
NewMenuEntry->OptionNumber = BootOrderList[Index];
|
||||||
NewLoadContext->Deleted = FALSE;
|
NewLoadContext->Deleted = FALSE;
|
||||||
@ -341,7 +332,7 @@ BOpt_GetBootOptions (
|
|||||||
//
|
//
|
||||||
// Is a Legacy Device?
|
// Is a Legacy Device?
|
||||||
//
|
//
|
||||||
Ptr = (UINT8 *) LoadOption;
|
Ptr = (UINT8 *) LoadOptionFromVar;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attribute = *(UINT32 *)Ptr;
|
// Attribute = *(UINT32 *)Ptr;
|
||||||
@ -423,6 +414,7 @@ BOpt_GetBootOptions (
|
|||||||
|
|
||||||
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
|
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
|
||||||
MenuCount++;
|
MenuCount++;
|
||||||
|
FreePool (LoadOptionFromVar);
|
||||||
}
|
}
|
||||||
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
|
||||||
|
|
||||||
@ -433,7 +425,6 @@ BOpt_GetBootOptions (
|
|||||||
FreePool (BootOrderList);
|
FreePool (BootOrderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool(LoadOption);
|
|
||||||
BootOptionMenu.MenuNumber = MenuCount;
|
BootOptionMenu.MenuNumber = MenuCount;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -643,7 +634,6 @@ BOpt_GetDriverOptions (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT16 DriverString[12];
|
UINT16 DriverString[12];
|
||||||
UINT8 *LoadOptionFromVar;
|
UINT8 *LoadOptionFromVar;
|
||||||
UINT8 *LoadOption;
|
|
||||||
UINTN DriverOptionSize;
|
UINTN DriverOptionSize;
|
||||||
|
|
||||||
UINT16 *DriverOrderList;
|
UINT16 *DriverOrderList;
|
||||||
@ -684,13 +674,6 @@ BOpt_GetDriverOptions (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadOption = AllocateZeroPool (DriverOptionSize);
|
|
||||||
if (LoadOption == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
|
|
||||||
FreePool (LoadOptionFromVar);
|
|
||||||
|
|
||||||
NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
|
NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
|
||||||
if (NULL == NewMenuEntry) {
|
if (NULL == NewMenuEntry) {
|
||||||
@ -698,8 +681,8 @@ BOpt_GetDriverOptions (
|
|||||||
}
|
}
|
||||||
|
|
||||||
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
|
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
|
||||||
LoadOptionPtr = LoadOption;
|
LoadOptionPtr = LoadOptionFromVar;
|
||||||
LoadOptionEnd = LoadOption + DriverOptionSize;
|
LoadOptionEnd = LoadOptionFromVar + DriverOptionSize;
|
||||||
NewMenuEntry->OptionNumber = DriverOrderList[Index];
|
NewMenuEntry->OptionNumber = DriverOrderList[Index];
|
||||||
NewLoadContext->Deleted = FALSE;
|
NewLoadContext->Deleted = FALSE;
|
||||||
NewLoadContext->IsLegacy = FALSE;
|
NewLoadContext->IsLegacy = FALSE;
|
||||||
@ -761,13 +744,14 @@ BOpt_GetDriverOptions (
|
|||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
|
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
|
||||||
|
FreePool (LoadOptionFromVar);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DriverOrderList != NULL) {
|
if (DriverOrderList != NULL) {
|
||||||
FreePool (DriverOrderList);
|
FreePool (DriverOrderList);
|
||||||
}
|
}
|
||||||
FreePool(LoadOption);
|
|
||||||
DriverOptionMenu.MenuNumber = Index;
|
DriverOptionMenu.MenuNumber = Index;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user