PQnotifies and freeing memory.

Started by Joshua Moore-Olivaover 22 years ago2 messagesgeneral
Jump to latest
#1Joshua Moore-Oliva
josh@chatgris.com

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.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joshua Moore-Oliva (#1)
Re: PQnotifies and freeing memory.

Joshua Moore-Oliva <josh@chatgris.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