Fix the checking logic for the boot option enumeration.
Fix the memory leak issue. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11098 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1134ead4a3
commit
0fa3ac1bb8
|
@ -1020,18 +1020,26 @@ BdsLibEnumerateAllBootOption (
|
||||||
if (mEnumBootDevice) {
|
if (mEnumBootDevice) {
|
||||||
LastLang = GetVariable (L"LastEnumLang", &mBdsLibLastLangGuid);
|
LastLang = GetVariable (L"LastEnumLang", &mBdsLibLastLangGuid);
|
||||||
PlatLang = GetEfiGlobalVariable (L"PlatformLang");
|
PlatLang = GetEfiGlobalVariable (L"PlatformLang");
|
||||||
if (LastLang == PlatLang) {
|
ASSERT (PlatLang != NULL);
|
||||||
|
if ((LastLang != NULL) && (AsciiStrCmp (LastLang, PlatLang) == 0)) {
|
||||||
Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
|
Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
|
||||||
|
FreePool (LastLang);
|
||||||
|
FreePool (PlatLang);
|
||||||
return Status;
|
return Status;
|
||||||
} else {
|
} else {
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
L"LastEnumLang",
|
L"LastEnumLang",
|
||||||
&mBdsLibLastLangGuid,
|
&mBdsLibLastLangGuid,
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||||
sizeof (PlatLang),
|
AsciiStrSize (PlatLang),
|
||||||
PlatLang
|
PlatLang
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
if (LastLang != NULL) {
|
||||||
|
FreePool (LastLang);
|
||||||
|
}
|
||||||
|
FreePool (PlatLang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue