py_talloc interface

Jelmer Vernooij jelmer at vernstok.nl
Wed Apr 21 05:47:01 MDT 2010


Hi Tridge,

On Wed, 2010-04-21 at 20:12 +1000, tridge at samba.org wrote:
>  > Thanks! This makes the bug less visible, but I think we should also make
>  > make the code fail in this situation and fix
>  > PyCredentialCacheContainerObject. Things like py_talloc_dealloc should
>  > ensure that they are only used with objects that were created using
>  > those functions, perhaps using a magic value?
> 
> I did consider using talloc_set_name() to a magic value on the
> mem_ctx, and have it check that, but I thought there may be users who
> are not using the py_talloc allocator for all allocations that end up
> at the de-allocator. If you think this shouldn't be allowed then I can
> put the check in.
I was thinking of putting a magic value in the py_talloc_Object struct,
but I guess putting a magic value inside of the TALLOC_CTX would work as
well. It'd be nice to put such a check in, since mixing these different
objects is bound to lead to nasty bugs.

Cheers,

jelmer


More information about the samba-technical mailing list