summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-15 13:28:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:09 -0500
commitcab68a413b55818c3ed5003832d65f976abce28f (patch)
tree0346354cabc4bc9e40c0c414e473fb49e3bd8c85
parent624544f06561a5fcf374dd29d26838642bee0670 (diff)
downloadsamba-cab68a413b55818c3ed5003832d65f976abce28f.tar.gz
samba-cab68a413b55818c3ed5003832d65f976abce28f.tar.bz2
samba-cab68a413b55818c3ed5003832d65f976abce28f.zip
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)
-rw-r--r--source4/lib/talloc/talloc.c8
-rw-r--r--source4/lib/talloc/testsuite.c3
2 files changed, 4 insertions, 7 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;
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;
}