talloc_tos in shadow_copy2_insert_string

Andrew Klaassen clawsoon at yahoo.com
Tue Mar 27 09:12:06 MDT 2012

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?



More information about the samba-technical mailing list