summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-10 11:16:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:24 -0500
commitf6274959ba381b6b5d025cb0cee78665107a72a6 (patch)
tree750d88afc3f88f833162dc7d9ae93d844b61a4e4 /source4/lib
parent1cd4339b9a2786aa26691ca4f02fa93ab0958b88 (diff)
downloadsamba-f6274959ba381b6b5d025cb0cee78665107a72a6.tar.gz
samba-f6274959ba381b6b5d025cb0cee78665107a72a6.tar.bz2
samba-f6274959ba381b6b5d025cb0cee78665107a72a6.zip
r20647: add cluster code
(This used to be commit 5870830b99a8d76bda1ff5af3fcf8dda9aba50ec)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/talloc/testsuite.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source4/lib/talloc/testsuite.c b/source4/lib/talloc/testsuite.c
index 88ed638252..dbfe3e4417 100644
--- a/source4/lib/talloc/testsuite.c
+++ b/source4/lib/talloc/testsuite.c
@@ -1028,6 +1028,39 @@ static bool test_autofree(void)
return true;
}
+static bool test_incref(void)
+{
+ void *top = talloc_new(NULL);
+ char *a = talloc_strdup(top, "/");
+ char *b = talloc_strdup(a,"/b");
+ char *c = talloc_strdup(b,"/b/a");
+
+ // Make a have some more children
+ talloc_strdup(a,"/c");
+ talloc_strdup(a,"/d");
+ talloc_strdup(a,"/e");
+
+ // Now b has some more other children.
+ talloc_strdup(b,"/b/b");
+
+ //Now we incref c presumably because we want to keep it valid:
+ talloc_increase_ref_count(c);
+
+ // I am freeing a here, but I expect c to still be valid because I have
+ // increased reference for it just above.
+ talloc_free(a);
+
+ talloc_report_full(NULL, stdout);
+
+ // This is where talloc aborts, valgrind indicates a double free
+ talloc_free(c);
+
+ CHECK_BLOCKS("top", top, 1);
+
+ return true;
+};
+
+
struct torture_context;
bool torture_local_talloc(struct torture_context *tctx)
{
@@ -1044,6 +1077,7 @@ bool torture_local_talloc(struct torture_context *tctx)
ret &= test_ref4();
ret &= test_unlink1();
ret &= test_misc();
+ ret &= test_incref();
ret &= test_realloc();
ret &= test_realloc_child();
ret &= test_steal();