[RFC] Making talloc_reference() safer.
rusty at rustcorp.com.au
Wed Oct 26 05:48:52 MDT 2011
On Wed, 26 Oct 2011 20:45:23 +1100, Andrew Bartlett <abartlet at samba.org> wrote:
> All samba talloc objects can be exposed into python, and in particular
> NDR objects are used in python a lot. The current talloc modal works
> well here, as we take a talloc reference each time we expose the object
> into python, and we take a talloc reference each time we hold an
> python-originated object into a long-term C structure (such as
> gensec_start needing credentials). This ensures that the object, which
> in C may be held by implicit rules of 'you would be mad to free *that*
> before this finishes' isn't taken away by python's garbage collector.
Indeed, we haven't discussed this at all, and I still don't understand
how this works.
Do you really want a reference from another parent, or to just bump the
reference count? The two cases are subtly different; we could safely
allow the latter without allowing carte-blanche on the former.
More information about the samba-technical