Re: PQnotifies and freeing memory.

Lists: pgsql-general
From: Joshua Moore-Oliva <josh(at)chatgris(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PQnotifies and freeing memory.
Date: 2003-10-11 09:10:53
Message-ID: 200310110510.53507.josh@chatgris.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

After reading the below struct and free statement, I am rather confused..

Do I need to free the struct, the char *, or both?

Thanks.

PGnotify* PQnotifies(PGconn *conn);

typedef struct pgNotify {
char *relname; /* name of relation containing data */
int be_pid; /* process id of backend */
} PGnotify;

After processing a PGnotify object returned by PQnotifies, be sure to free it
with free() to avoid a memory leak.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joshua Moore-Oliva <josh(at)chatgris(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PQnotifies and freeing memory.
Date: 2003-10-14 16:03:28
Message-ID: 9785.1066147408@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Joshua Moore-Oliva <josh(at)chatgris(dot)com> writes:
> After reading the below struct and free statement, I am rather confused..
> Do I need to free the struct, the char *, or both?

The struct.

regards, tom lane