diff options
author | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-11-26 06:33:19 +0000 |
---|---|---|
committer | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-11-26 06:33:19 +0000 |
commit | 0fa3ac1bb8289515bc37a3684749057d63b1fb01 (patch) | |
tree | f986a69b85133398fa959b0ec56a8665415c3cb3 /IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | |
parent | 1134ead4a3fa98d1efd2bfe9d64cfd6a2272a2e4 (diff) | |
download | edk2-platforms-0fa3ac1bb8289515bc37a3684749057d63b1fb01.tar.xz |
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
Diffstat (limited to 'IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c')
-rw-r--r-- | IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 12 |
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);
}
}
|