From 9090c8b533013078c6df773e128070c76d917830 Mon Sep 17 00:00:00 2001 From: Thomas Palmer Date: Wed, 4 Jul 2018 00:46:01 +0800 Subject: [PATCH 1/1] 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 Reviewed-by: Dandan Bi Reviewed-by: Star Zeng --- MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c index f2eac4d3fe..7390f954b6 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -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; -- 2.39.2