Browse Source

* Free postgres-results, fixed resource-leaking, probably fixes bug #13025

git-svn-id: trunk@12598 -
joost 16 years ago
parent
commit
3ef9342d59
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/fcl-db/src/sqldb/postgres/pqconnection.pp

+ 4 - 0
packages/fcl-db/src/sqldb/postgres/pqconnection.pp

@@ -544,6 +544,7 @@ begin
     begin
     if not tr.ErrorOccured then
       begin
+      PQclear(res);
       res := pqexec(tr.PGConn,pchar('deallocate prepst'+nr));
       if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
         begin
@@ -568,6 +569,7 @@ begin
     begin
     if FStatementType in [stInsert,stUpdate,stDelete,stSelect] then
       begin
+      pqclear(res);
       if Assigned(AParams) and (AParams.count > 0) then
         begin
         setlength(ar,Aparams.count);
@@ -615,6 +617,8 @@ begin
       else
         s := Statement;
       res := pqexec(tr.PGConn,pchar(s));
+      if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
+        pqclear(res);
       end;
     if not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
       begin