[QUICK] talloc bugs

tridge at samba.org tridge at samba.org
Sun Jun 28 22:25:40 MDT 2009

Hi Sam,

Thanks for bringing this to our attention again. 

As I mentioned the last time around, my preference is to keep the
current behaviour, except to disallow direct talloc_free() of a
pointer that has outstanding references. The idea is that if you free
something with a reference either by the reference parent or by a
direct parent then the intention of the caller is very clear. The only
ambiguity is where you call talloc_free() on a pointer directly where
that pointer has a outstanding reference. In that case the talloc code
has no way of knowing which parent you intend to keep, and the caller
should instead call a function that provides that information (such as

What I don't know is whether this should be the default behaviour, or
if we should have an inheritable flag to set this behaviour. That
really depends on whether how much we are currently relying on direct
free of pointers with references in our current code base. I haven't
run that experiment.

Do you have time to test this solution?

Cheers, Tridge

More information about the samba-technical mailing list