Skip site navigation (1) Skip section navigation (2)

libpq & freeing character results

From: "Robert A(dot) Knop Jr(dot)" <rknop(at)lilys(dot)lbl(dot)gov>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: libpq & freeing character results
Date: 2000-06-27 19:06:44
Message-ID: Pine.LNX.4.10.10006271204130.1921-100000@lilys.lbl.gov (view raw or flat)
Thread:
Lists: pgsql-interfaces
If one uses libpq functions such as PQfname, should one free the returned
character string?

What I'm really asking is, are you getting a pointer into something
internal to the PGresult structure, which is only valid as long as the
PGresult structure is valid, and which must be copied if it is to exist
after that; or, are you getting a copy of that memory, which is yours to
do with as you please (and your responsibility)?

This is explicitly answered in the documentation for PQgetvalue (it's a
pointer into the PGresult data), so I'm assuming thatt he same applies for
PQfname.  Please let me know if this is a foolish assumption.

-Rob
rknop(at)lbl(dot)gov



Responses

pgsql-interfaces by date

Next:From: tomasDate: 2000-06-27 20:20:49
Subject: Re: libpq & freeing character results
Previous:From: rootDate: 2000-06-27 16:41:02
Subject: I need help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group