talloc_tos() Re: 617ec07 ?

Jeremy Allison jra at samba.org
Tue Aug 10 17:28:55 MDT 2010


On Wed, Aug 11, 2010 at 08:27:21AM +1000, Andrew Bartlett wrote:

> For this simple case, where we allocate exactly one variable and then
> free it, it seemed simplest to just allocate it on another context.  

+1 on that - I checked over the patch also to make sure it
wasn't leaking anything :-). But for more complex code, it
isn't so easy to check.

> Honestly, I'm not a great fan of talloc_tos().  I've had it explained to
> me multiple times, and I appreciate that it both works and solves real
> world problems, but things like the SMB_ASSERT() on allocation failure
> and (more particularly) it being just a little bit opaque still makes me
> uncomfortable. 

As we merge the codebase you'll probably get more familiar with
it. It's an absolute godsend when doing complex cleanups. It's
also threadsafe, which will become much more important in the
future (I'm on a campaign to remove all static null talloc contexts
eventually :-).

Jeremy


More information about the samba-technical mailing list