summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 8ee0b3e698..61699edeb8 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -1020,18 +1020,26 @@ BdsLibEnumerateAllBootOption (
if (mEnumBootDevice) {
LastLang = GetVariable (L"LastEnumLang", &mBdsLibLastLangGuid);
PlatLang = GetEfiGlobalVariable (L"PlatformLang");
- if (LastLang == PlatLang) {
+ ASSERT (PlatLang != NULL);
+ if ((LastLang != NULL) && (AsciiStrCmp (LastLang, PlatLang) == 0)) {
Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
+ FreePool (LastLang);
+ FreePool (PlatLang);
return Status;
} else {
Status = gRT->SetVariable (
L"LastEnumLang",
&mBdsLibLastLangGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (PlatLang),
+ AsciiStrSize (PlatLang),
PlatLang
);
ASSERT_EFI_ERROR (Status);
+
+ if (LastLang != NULL) {
+ FreePool (LastLang);
+ }
+ FreePool (PlatLang);
}
}