From: Qiu Shumin Date: Fri, 25 Dec 2015 01:29:38 +0000 (+0000) Subject: Subject: [PATCH 5/9] ShellPkg: Fix memory leak in function'ManBufferFindSections'. X-Git-Tag: edk2-stable201903~8134 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4afbcc112b666dbebeca54d11bd5f84b814b92ed;p=mirror_edk2.git Subject: [PATCH 5/9] ShellPkg: Fix memory leak in function'ManBufferFindSections'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin Reviewed-by: Yao Jiewen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19525 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Application/Shell/ShellManParser.c index 6c1849199c..222cdafd6e 100644 --- a/ShellPkg/Application/Shell/ShellManParser.c +++ b/ShellPkg/Application/Shell/ShellManParser.c @@ -215,6 +215,7 @@ ManBufferFindSections( SectionLen = StrLen(SectionName); SectionName = StrStr(Sections, SectionName); if (SectionName == NULL) { + SHELL_FREE_NON_NULL(TempString); continue; } if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') { @@ -250,6 +251,7 @@ ManBufferFindSections( } SHELL_FREE_NON_NULL(TempString); } + SHELL_FREE_NON_NULL(TempString); if (!Found && !EFI_ERROR(Status)) { return (EFI_NOT_FOUND); }