(libpq) PQclear on questionable result pointer.

From: wade <wade(at)wavefire(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: (libpq) PQclear on questionable result pointer.
Date: 2002-08-30 16:56:58
Message-ID: 3.0.32.20020830095658.02af6620@mail.wavefire.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greets all,
While attempting to clean up some memory leaks, I have encountered some
difficulties. In the code for PQclear() we have the check:

if (!res)
return;

The problem arrises when the result object pointer you are passing to clear
contains not a null and not a valid result object address, but a junk pointer.
PQclear() seg faults when the address is outside of the data segment.
(libpq bug?)

My question is, how does one determine when a PGresult* contains the address
of a valid result object? Rewriting the calling code is not an option sadly.
What I would like to be able to do is something like this:

if ( result_is_valid( res ) )
{
PQclear( res );
}

Thanks in advance for any help/suggestions.
-Wade

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-30 17:01:56 Re: (libpq) PQclear on questionable result pointer.
Previous Message Joe Conway 2002-08-30 16:25:51 Re: make failure on cvs tip