| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | "John Hansen" <john(at)geeknet(dot)com(dot)au> | 
| Cc: | "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: PG_FREE_IF_COPY() | 
| Date: | 2005-06-14 14:27:21 | 
| Message-ID: | 28383.1118759241@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
"John Hansen" <john(at)geeknet(dot)com(dot)au> writes:
> Given the following snippet:
> 	HeapTupleHeader     tuple;
> 	Datum               temp;
> 	bool			  isnull;
	
> 	tuple = PG_GETARG_HEAPTUPLEHEADER(0);
> 	temp  = GetAttributeByName(tuple, "data", &isnull);
> When using this for a btree operator functions, you need to
> PG_FREE_IF_COPY(?,?);
> Which of the above parameters need I free?
It'd probably be wise to do a FREE_IF_COPY on the tuple.
GetAttributeByName, however, hasn't copied anything (if it's
a pass-by-ref type you'll just get a pointer into the tuple).
If you do a copy further down that might be a reason to free
something, but this code alone isn't making a copy.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Hansen | 2005-06-14 14:30:02 | Re: PG_FREE_IF_COPY() | 
| Previous Message | Teodor Sigaev | 2005-06-14 14:01:33 | Re: Gist Recovery testing |