Re: allowing multiple PQclear() calls - Mailing list pgsql-hackers

From Tom Lane
Subject Re: allowing multiple PQclear() calls
Date
Msg-id 7040.1355209937@sss.pgh.pa.us
Whole thread Raw
In response to allowing multiple PQclear() calls  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-hackers
Josh Kupershmidt <schmiddy@gmail.com> writes:
> Would it be crazy to add an "already_freed" flag to the pg_result
> struct which PQclear() would set, or some equivalent safety mechanism,
> to avoid this hassle for users?

Yes, it would.  Once the memory has been freed, malloc() is at liberty
to give it out for some other purpose.  The only way we could make that
work reliably is to permanently leak the memory occupied by the PGresult
... which I trust you will agree is a cure worse than the disease.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Darren Duncan
Date:
Subject: Re: MySQL search query is not executing in Postgres DB
Next
From: Heikki Linnakangas
Date:
Subject: Re: [BUG?] lag of minRecoveryPont in archive recovery