Use after talloc_free...

simo idra at
Wed Nov 11 07:29:28 MST 2009

On Wed, 2009-11-11 at 21:09 +1030, Rusty Russell wrote:
> On Wed, 11 Nov 2009 06:44:34 pm Volker Lendecke wrote:
> > On Wed, Nov 11, 2009 at 06:40:14PM +1030, Rusty Russell wrote:
> > > Two recent CTDB fixes (1cbf06a126621 and eda052101728cf) both fixed obvious
> > > use-after-free bugs[1].  This has convinced me that something like SAFE_FREE
> > > would be nice in talloc.
> > 
> > We have TALLOC_FREE in Samba3 for ages.
> Exactly!  That was my "something like SAFE_FREE" reference.  But YELLING is
> not an appealing coding style, nor do I like the magic NULL-setting which I've
> found that people rely on.  I'd rather see an explicit NULL set if it's
> required.
> So if we're going to promote this in talloc, I'd like to do it differently...

Rusty I use talloc_zfree() in the sssd code.
It is compact and should express the idea you are zeroing the pointer.
I'd prefer it over longer constructs or the TALLOC_FREE all caps way.


Simo Sorce
Samba Team GPL Compliance Officer <simo at>
Principal Software Engineer at Red Hat, Inc. <simo at>

More information about the samba-technical mailing list