diff options
Diffstat (limited to 'source4/lib/talloc/talloc.c')
-rw-r--r-- | source4/lib/talloc/talloc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index ab199678c1..05bc09a21e 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -585,10 +585,6 @@ int talloc_free(void *ptr) tc->destructor = NULL; } - tc->flags |= TALLOC_FLAG_LOOP; - - talloc_free_children(ptr); - if (tc->parent) { _TLIST_REMOVE(tc->parent->child, tc); if (tc->parent->child) { @@ -599,8 +595,10 @@ int talloc_free(void *ptr) if (tc->next) tc->next->prev = tc->prev; } - tc->flags |= TALLOC_FLAG_FREE; + tc->flags |= TALLOC_FLAG_LOOP; + talloc_free_children(ptr); + tc->flags |= TALLOC_FLAG_FREE; old_errno = errno; free(tc); errno = old_errno; |