question about _talloc_free

Herb Lewis hlewis at
Mon Apr 13 23:00:05 GMT 2009

in lib/talloc/talloc.c we have the following function defined

static inline int _talloc_free(void *ptr)

inside this function we have the following code

         if (unlikely(tc->refs)) {
                 int is_child;
                 /* check this is a reference from a child or grantchild
                  * back to it's parent or grantparent
                  * in that case we need to remove the reference and
                  * call another instance of talloc_free() on the current
                  * pointer.
                 is_child = talloc_is_parent(tc->refs, ptr);
                 if (is_child) {
                         return _talloc_free(ptr);
                 return -1;

First in the comments "grantchild" should be "grandchild"

Second, since _talloc_free is declared as inline, this generates a
warning that it cannot be inlined when you call _talloc_free from
inside the function.

If the recursion was intended, we should probably remove the inline
in the declaration to fix the warnings.

More information about the samba-technical mailing list