MdeModulePkg/DisplayEngineDxe: Fix small InitializeDisplayEngine leak
authorThomas Palmer <thomas.palmer@hpe.com>
Tue, 3 Jul 2018 16:46:01 +0000 (00:46 +0800)
committerStar Zeng <star.zeng@intel.com>
Fri, 6 Jul 2018 11:15:56 +0000 (19:15 +0800)
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>
MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c

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