From: Yao Jiewen Date: Fri, 25 Dec 2015 01:33:53 +0000 (+0000) Subject: ShellPkg: Fix memory leak in function'ShellCommandRunHelp'. X-Git-Tag: edk2-stable201903~8133 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=5b77132c8f46e74d0f882c272fbfcf5bda83b11a;hp=4afbcc112b666dbebeca54d11bd5f84b814b92ed ShellPkg: Fix memory leak in function'ShellCommandRunHelp'. When run help command Shell may have memory leak. This patch fix this bug. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yao Jiewen Reviewed-by: Qiu Shumin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19526 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c index c8d0e7887c..619cdd38a7 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); }