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

From: Christof Petig <christof(at)petig-baender(dot)de>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL Interfaces <pgsql-interfaces(at)postgresql(dot)org>, Mark Aves <maves(at)csl(dot)co(dot)uk>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?
Date: 2002-05-06 12:47:31
Message-ID: 3CD67B63.8090304@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-05-06 13:36:02 Re: Native Windows, Apache Portable Runtime
Previous Message Marc G. Fournier 2002-05-06 12:01:36 Re: HEADS UP: Win32/OS2/BeOS native ports

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2002-05-06 15:27:08 Re: Using C functions with triggers
Previous Message Michael Meskes 2002-05-06 11:00:51 Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?