Browse Source

* Fix for 37993, attempt to prevent memory leak in case of database shutdown

git-svn-id: trunk@47216 -
(cherry picked from commit 6d5816085d94fd8498cd9d34d5e0cf8839d74c9c)
michael 4 years ago
parent
commit
07d353c3c6
1 changed files with 6 additions and 3 deletions
  1. 6 3
      packages/fcl-db/src/sqldb/sqldb.pp

+ 6 - 3
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1373,9 +1373,12 @@ end;
 
 destructor TSQLConnection.Destroy;
 begin
-  Connected:=False; // needed because we want to de-allocate statements
-  FreeAndNil(FStatements);
-  inherited Destroy;
+  try
+    Connected:=False; // needed because we want to de-allocate statements
+  Finally  
+    FreeAndNil(FStatements);
+    inherited Destroy;
+  end;
 end;
 
 function TSQLConnection.StrToStatementType(s : string) : TStatementType;