Re: ECPG: FETCH ALL|n FROM cursor - Memory allocation? - Mailing list pgsql-interfaces

From Christof Petig
Subject Re: ECPG: FETCH ALL|n FROM cursor - Memory allocation?
Date
Msg-id 3CD67B63.8090304@petig-baender.de
Whole thread Raw
In response to ECPG: FETCH ALL|n FROM cursor - Memory allocation?  (Lee Kindness <lkindness@csl.co.uk>)
List pgsql-interfaces
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



pgsql-interfaces by date:

Previous
From: "Leslie Herps"
Date:
Subject: [ERROR] pgsql_perl5
Next
From: Tom Lane
Date:
Subject: Re: Using C functions with triggers