Browse Source

* Fixed memory leak caused by FSocket not being freed if error during connect (bug ID 26959)

git-svn-id: trunk@30619 -
michael 10 years ago
parent
commit
f67cbabdc6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fcl-web/src/base/fphttpclient.pp

+ 6 - 1
packages/fcl-web/src/base/fphttpclient.pp

@@ -456,7 +456,12 @@ begin
       Aport:=80;
   G:=GetSocketHandler(UseSSL);    
   FSocket:=TInetSocket.Create(AHost,APort,G);
-  FSocket.Connect;
+  try
+    FSocket.Connect;
+  except
+    FreeAndNil(FSocket);
+    Raise;
+  end;
 end;
 
 procedure TFPCustomHTTPClient.DisconnectFromServer;