hmm.. Re: talloc issues

Sam Liddicott sam at liddicott.com
Tue Jul 28 08:47:05 MDT 2009


* Volker Lendecke wrote, On 28/07/09 15:36:
> On Tue, Jul 28, 2009 at 03:30:38PM +0100, Sam Liddicott wrote:
>> I am surprised that talloc_free is used in so many places, and think
>> this is what needs removing;
> 
> ???


I mean that when talloc_free was understood to remove the most recent
parent, it was used liberally.

If talloc_free means to remove only the allocating parent then it should
almost never be used, and those that took references should release
references.

Many uses of talloc_free should be talloc_unreference. Talloc_free
should only exist in functions intended to take ownership; but this is
not the case hence the difficulty in fixing up existing code.

My answer is to stop using talloc_free except in cases where you can
prove it is safe, but tridge has found cases where it looked safe but
wasn't.

Sam



More information about the samba-technical mailing list