Browse Source

fppkg: fixed mem leak

mattias 2 years ago
parent
commit
45cfdcc582
1 changed files with 9 additions and 6 deletions
  1. 9 6
      packages/fppkg/src/pkgglobals.pp

+ 9 - 6
packages/fppkg/src/pkgglobals.pp

@@ -377,12 +377,15 @@ begin
   Close (TmpFile);
   Close (TmpFile);
 {$ELSE USE_SHELL}
 {$ELSE USE_SHELL}
   S:=TProcess.Create(Nil);
   S:=TProcess.Create(Nil);
-  S.Commandline:=ACompiler+' '+AOptions;
-  S.ShowWindow:=swoHIDE;
-  S.Options:=[poUsePipes];
-  S.execute;
-  Count:=s.output.read(buf,BufSize);
-  S.Free;
+  try
+    S.Commandline:=ACompiler+' '+AOptions;
+    S.ShowWindow:=swoHIDE;
+    S.Options:=[poUsePipes];
+    S.execute;
+    Count:=s.output.read(buf,BufSize);
+  finally
+    S.Free;
+  end;
 {$ENDIF USE_SHELL}
 {$ENDIF USE_SHELL}
   SetLength(Result,Count);
   SetLength(Result,Count);
   Move(Buf,Result[1],Count);
   Move(Buf,Result[1],Count);