Browse Source

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

git-svn-id: trunk@47216 -
michael 4 years ago
parent
commit
6d5816085d
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;