Reviewed by: [email protected]

-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Qiu 
Shumin
Sent: Thursday, December 24, 2015 2:10 PM
To: [email protected]
Cc: Ni, Ruiyu; Carsey, Jaben; Qiu, Shumin; Yao, Jiewen
Subject: [edk2] [PATCH v2 1/2] ShellPkg: Fix memory leak in function 
'ManBufferFindSections'.

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

diff --git a/ShellPkg/Application/Shell/ShellManParser.c 
b/ShellPkg/Application/Shell/ShellManParser.c
index 6c18491..222cdaf 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);
   }
--
1.9.5.msysgit.1

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

Reply via email to