]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/ParseGuidedSectionTools.c
BaseTools/C/Common: Fix potential memory leak
[mirror_edk2.git] / BaseTools / Source / C / Common / ParseGuidedSectionTools.c
index fc8f488f7e46e646c30a62b6e9a305bcc7c90077..115cfa41439f7b0b6cebe510ef6f45ef5d30c320 100644 (file)
@@ -125,10 +125,12 @@ Returns:
     \r
     Status = StripInfDscStringInPlace (NextLine);\r
     if (EFI_ERROR (Status)) {\r
+      free (NextLine);\r
       break;\r
     }\r
 \r
     if (NextLine[0] == '\0') {\r
+      free (NextLine);\r
       continue;\r
     }\r
 \r
@@ -153,8 +155,12 @@ Returns:
           LastGuidTool = NewGuidTool;\r
         }\r
       }\r
+    }\r
+\r
+    if (Tool != NULL) {\r
       FreeStringList (Tool);\r
     }\r
+    free (NextLine);\r
   }\r
 \r
   return FirstGuidTool;\r