When run help command Shell may have memory leak. This patch fix this bug.

Cc: Ruiyu Ni <[email protected]>
Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yao Jiewen <[email protected]>
Reviewed-by: Qiu Shumin <[email protected]>
---
 ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c 
b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
index c8d0e78..619cdd3 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
@@ -311,6 +311,7 @@ ShellCommandRunHelp (
   ShellStatus         = SHELL_SUCCESS;
   CommandToGetHelpOn  = NULL;
   SectionToGetHelpOn  = NULL;
+  SortedCommandList   = NULL;
   Found               = FALSE;
 
   //
@@ -471,6 +472,7 @@ ShellCommandRunHelp (
   if (SectionToGetHelpOn != NULL) {
     FreePool(SectionToGetHelpOn);
   }
+  SHELL_FREE_NON_NULL(SortedCommandList);
 
   return (ShellStatus);
 }
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to