[fpc-devel] fcl-db / posgres Memory Leaks

Andrew Brunner andrew.t.brunner at gmail.com
Wed Dec 8 19:41:52 CET 2010


Postgres has some problems with the unit code.  WIthout getting into
personal preferences with code indentation (eye rolls)  I would like to
point out that (at least on windows) reading res after pqclear(res) will
result in a SIGFAULT error.

So inspecting pqconnection.Execute(...)

      res := pqexec(tr.PGConn,pchar(s));
      if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
begin
        pqclear(res);
 <snip>
    if not (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
      begin
      s := PQerrorMessage(tr.PGConn);

I'm consistently getting a SIGFAULT error unless I set res to nil and change
the following


      res := pqexec(tr.PGConn,pchar(s));
      if (PQresultStatus(res) in [PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
begin
        pqclear(res);
       res:=nil;
 <snip>
    if (res<>nil) and not (PQresultStatus(res) in
[PGRES_COMMAND_OK,PGRES_TUPLES_OK]) then
      begin
      s := PQerrorMessage(tr.PGConn);

Can someome please review pqconnection.pp and fix this?  I'm having to
re-apply my fix every time I update and my bug report is going unheeded.
Which is crippling my ability to even use Postgres.

Please, fix soon :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101208/a747c76d/attachment.html>


More information about the fpc-devel mailing list