Explorar o código

fppkg: fixed mem leak

mattias %!s(int64=2) %!d(string=hai) anos
pai
achega
45cfdcc582
Modificáronse 1 ficheiros con 9 adicións e 6 borrados
  1. 9 6
      packages/fppkg/src/pkgglobals.pp

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

@@ -377,12 +377,15 @@ begin
   Close (TmpFile);
 {$ELSE USE_SHELL}
   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}
   SetLength(Result,Count);
   Move(Buf,Result[1],Count);