MdeModulePkg/DisplayEngineDxe: Fix small InitializeDisplayEngine leak

After calling RegisterHotKey, the allocated memory in NewString should
be freed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Thomas Palmer 2018-07-04 00:46:01 +08:00 committed by Star Zeng
parent 4d76bbcce6
commit 9090c8b533
1 changed files with 2 additions and 0 deletions

View File

@ -4221,11 +4221,13 @@ InitializeDisplayEngine (
NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_TEN_STRING), NULL);
ASSERT (NewString != NULL);
FormBrowserEx2->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0, NewString);
FreePool (NewString);
HotKey.ScanCode = SCAN_F9;
NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_NINE_STRING), NULL);
ASSERT (NewString != NULL);
FormBrowserEx2->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD, NewString);
FreePool (NewString);
}
return EFI_SUCCESS;