mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 11:49:23 +02:00
* fixed minor logic errors in pqconnection that lead to double free (actually pqclear()). Mantis 17784 by Andrew Brunner
git-svn-id: trunk@17078 -
This commit is contained in:
parent
d08662c1ba
commit
75cdb5b244
@ -561,10 +561,11 @@ begin
|
||||
res := pqexec(tr.PGConn,pchar('deallocate prepst'+nr));
|
||||
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
|
||||
begin
|
||||
pqclear(res);
|
||||
DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
|
||||
end
|
||||
else
|
||||
pqclear(res);
|
||||
DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
|
||||
end;
|
||||
pqclear(res);
|
||||
end;
|
||||
FPrepared := False;
|
||||
end;
|
||||
@ -641,9 +642,12 @@ begin
|
||||
s := Statement;
|
||||
res := pqexec(tr.PGConn,pchar(s));
|
||||
if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
|
||||
pqclear(res);
|
||||
begin
|
||||
pqclear(res);
|
||||
res:=nil;
|
||||
end;
|
||||
end;
|
||||
if not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
|
||||
if assigned(res) and not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
|
||||
begin
|
||||
s := PQerrorMessage(tr.PGConn);
|
||||
pqclear(res);
|
||||
|
Loading…
Reference in New Issue
Block a user