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 <Jiewen.Yao@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19526 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yao Jiewen 2015-12-25 01:33:53 +00:00 committed by shenshushi
parent 4afbcc112b
commit 5b77132c8f
1 changed files with 2 additions and 0 deletions

View File

@ -311,6 +311,7 @@ ShellCommandRunHelp (
ShellStatus = SHELL_SUCCESS; ShellStatus = SHELL_SUCCESS;
CommandToGetHelpOn = NULL; CommandToGetHelpOn = NULL;
SectionToGetHelpOn = NULL; SectionToGetHelpOn = NULL;
SortedCommandList = NULL;
Found = FALSE; Found = FALSE;
// //
@ -471,6 +472,7 @@ ShellCommandRunHelp (
if (SectionToGetHelpOn != NULL) { if (SectionToGetHelpOn != NULL) {
FreePool(SectionToGetHelpOn); FreePool(SectionToGetHelpOn);
} }
SHELL_FREE_NON_NULL(SortedCommandList);
return (ShellStatus); return (ShellStatus);
} }