mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 02:59:33 +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));
|
res := pqexec(tr.PGConn,pchar('deallocate prepst'+nr));
|
||||||
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
|
if (PQresultStatus(res) <> PGRES_COMMAND_OK) then
|
||||||
begin
|
begin
|
||||||
|
pqclear(res);
|
||||||
|
DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
|
||||||
|
end
|
||||||
|
else
|
||||||
pqclear(res);
|
pqclear(res);
|
||||||
DatabaseError(SErrPrepareFailed + ' (PostgreSQL: ' + PQerrorMessage(tr.PGConn) + ')',self)
|
|
||||||
end;
|
|
||||||
pqclear(res);
|
|
||||||
end;
|
end;
|
||||||
FPrepared := False;
|
FPrepared := False;
|
||||||
end;
|
end;
|
||||||
@ -641,9 +642,12 @@ begin
|
|||||||
s := Statement;
|
s := Statement;
|
||||||
res := pqexec(tr.PGConn,pchar(s));
|
res := pqexec(tr.PGConn,pchar(s));
|
||||||
if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
|
if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
|
||||||
pqclear(res);
|
begin
|
||||||
|
pqclear(res);
|
||||||
|
res:=nil;
|
||||||
|
end;
|
||||||
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
|
begin
|
||||||
s := PQerrorMessage(tr.PGConn);
|
s := PQerrorMessage(tr.PGConn);
|
||||||
pqclear(res);
|
pqclear(res);
|
||||||
|
Loading…
Reference in New Issue
Block a user