Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?

Christof Petig <christof@petig-baender.de>

From: Christof Petig <christof@petig-baender.de>
To: Lee Kindness <lkindness@csl.co.uk>
Cc: Michael Meskes <meskes@postgresql.org>, PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>, Mark Aves <maves@csl.co.uk>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2002-05-06T12:47:31Z
Lists: pgsql-hackers
Lee Kindness wrote:
> Okay, lets see if i've got this right...
> 
> If I allocate the memory before the FETCH then I (naturally) free
> it. However If I NULL initialise the pointer then libecpg will
> allocate the memory and I must NOT free it - libecpg will free it
> automatically... Yeah?

No, I only said: Never mix free and ECPGfree_auto_mem because 
ECPGfree_auto_mem will double free it if you free'd it already.

And also: it might be a good idea to kill the undocumented function (and 
the list).

And: You need to free it (by one of the two methods above).

> 
> I think this highlights the need for some documentation on this
> aspect.

Yes it does.

   Christof