talloc_tos in shadow_copy2_insert_string
realrichardsharpe at gmail.com
Tue Mar 27 09:16:30 MDT 2012
On Tue, Mar 27, 2012 at 8:12 AM, Andrew Klaassen <clawsoon at yahoo.com> wrote:
> I've been trying to figure out talloc best practise by digging through docs and existing VFS
> modules. One thing I can't figure out:
> In vfs_shadow_copy2.c, function shadow_copy2_insert_string, the returned string hangs
> off a talloc_tos() context.
> Doesn't this mean that the string will be deallocated before it gets back to the calling
> function, when the callee function's stack is destroyed?
> This is what the code has:
> return talloc_asprintf(talloc_tos(), "/%s/%s",
> ...and this is what I was expecting to see:
> return talloc_asprintf(mem_ctx, "/%s/%s",
> ...since mem_ctx is passed to the function as an available talloc context (but never used).
> What am I missing?
My understanding was that things allocated with a talloc_tos() context
are cleaned up when the current SMB request is finished with.
However, it would be useful to find out exactly what the meaning of
More information about the samba-technical