From cab68a413b55818c3ed5003832d65f976abce28f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 15 Jul 2006 13:28:52 +0000 Subject: r17061: - remove the currect talloc chunk from it's parent before freeing the children this fixes an endless loop bug! - reenable the test for this should I merge this to samba3? metze (This used to be commit 0559222b62930765519aaab5d33609ece29014d6) --- source4/lib/talloc/talloc.c | 8 +++----- source4/lib/talloc/testsuite.c | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'source4/lib/talloc') 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; diff --git a/source4/lib/talloc/testsuite.c b/source4/lib/talloc/testsuite.c index 477d9a5848..2b04f66fc4 100644 --- a/source4/lib/talloc/testsuite.c +++ b/source4/lib/talloc/testsuite.c @@ -845,9 +845,8 @@ static BOOL test_lifeless(void) talloc_report_full(top, stdout); talloc_free(top); talloc_free(child_owner); -#if 0 talloc_free(child); -#endif + return True; } -- cgit