talloc quiz, and: dangling talloc references and inconsistencies in the talloc model

tridge at samba.org tridge at samba.org
Fri Jan 23 02:28:37 GMT 2009


Hi Sam,

 > I think this is a good assumption, but I think it is less likely to hold
 > true in a system of asynchronous modules (like vfs layers) when interest
 > in structures isn't necessarily nested, and where it is nearly
 > impossible to test whether or not a particular use will be safe at runtime.

right, but the same will be true of any other rule, just in different
circumstances.

One thing we could do is make the "cannot talloc_free when a pointer
has a reference" be dynamically settable. For example, we could have:

  talloc_set_flag(ptr, TALLOC_NO_REFERENCE_FREE);

and have the flag inherited by children. We have plenty of room in the
flags field of the talloc_chunk structure to hold a flag like this.

The semantics would be that if you set that flag, then talloc_free()
when there is more than one parent would fail, and you would need
talloc_unlink().

Cheers, Tridge

PS: Sorry for the slow dribble of replies - I'm at a conference this
week, then away for 2 weeeks after that. This will be an extended
conversation :-)


More information about the samba-technical mailing list