Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-12

fcl-db / posgres Memory Leaks

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Brunner

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 (resnil) 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 :-)

Reply by email