Use after talloc_free...

Jeremy Allison jra at
Wed Nov 11 18:40:39 MST 2009

On Thu, Nov 12, 2009 at 12:05:19PM +1030, Rusty Russell wrote:

> To be clear: I *don't* want magic NULL-ing. If you want to NULL a pointer
> because you're going to re-use it, I'd much rather that be explicit.  I want
> an instant way to detect use-after-free, whether it be double-free or other
> cases where NULL would be treated as special and mask the bug.

I understand your position on this, but the NULL-ing of TALLOC_FREE is baked
into a lot of the Samba3 code, which would break without it.

> I also don't want the non-C-like arg-modifying behavior of TALLOC_FREE
> (which is why it has to be upper case).  Hence I prefer a version which
> takes &ptr, making it clear that it will modify ptr.
> Basically, I think this mechanism is worthwhile becoming a 1st class
> talloc citizen, so we should design it carefully.

Fair enough, but we'll still need to keep the TALLOC_FREE macro


More information about the samba-technical mailing list