[PATCH] Remove all uses of talloc_autofree_context() from our code (except for test)

Jeremy Allison jra at samba.org
Tue Jul 25 19:37:24 UTC 2017


On Tue, Jul 25, 2017 at 09:24:57PM +0200, Volker Lendecke wrote:
> On Tue, Jul 25, 2017 at 09:05:07AM -0700, Jeremy Allison wrote:
> > Here is a patch to finally remove all uses of
> > talloc_autofree_context() from the Samba code
> > tree, except for the talloc tests that exercise
> > the talloc_autofree_context() functionality.
> > 
> > The final patch removes the calls to:
> > 
> > talloc_enable_null_tracking()
> > 
> > inside nmbd, smbd, winbind and samba
> 
> Does "smbcontrol smbd pool-usage" still work after this change?

No. If we're not using the global null_context within
talloc anymore, then pool usage doesn't have a central
place to track all allocations off it.

Having that is inconsistent with allowing thread-safe
access to that global I'm afraid. To keep it we need
to add mutex lock/ulock around all access to the talloc

static void *null_context;
static void *autofree_context;

variables.

The last patch could have a run-time selector to
decide whether to call talloc_enable_null_tracking().

Having talloc_enable_null_tracking() turned on
though makes it impossible to use talloc in any
NT code, which is what I'm trying to fix.

Jeremy.



More information about the samba-technical mailing list