summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-07-01 16:36:29 +1000
committerAndrew Tridgell <tridge@samba.org>2009-07-01 16:37:33 +1000
commit34d6d7cec82c50ce7b36fec0051063f44fed5609 (patch)
tree9525d20ea541184965c15d32420061c55f344bfa /lib/talloc
parent3c2f4df55532b17ef4957604ffe411eb885edbaf (diff)
downloadsamba-34d6d7cec82c50ce7b36fec0051063f44fed5609.tar.gz
samba-34d6d7cec82c50ce7b36fec0051063f44fed5609.tar.bz2
samba-34d6d7cec82c50ce7b36fec0051063f44fed5609.zip
fixed the talloc testsuite for the recent changes
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/testsuite.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 3d490ddf49..248edfb40d 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -125,7 +125,7 @@ static bool test_ref1(void)
CHECK_BLOCKS("ref1", r1, 2);
fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
+ talloc_unlink(r1, p2);
talloc_report_full(root, stderr);
CHECK_BLOCKS("ref1", p1, 5);
@@ -180,7 +180,7 @@ static bool test_ref2(void)
CHECK_BLOCKS("ref2", r1, 2);
fprintf(stderr, "Freeing ref\n");
- talloc_free(ref);
+ talloc_unlink(r1, ref);
talloc_report_full(root, stderr);
CHECK_BLOCKS("ref2", p1, 5);
@@ -372,7 +372,7 @@ static bool test_misc(void)
talloc_increase_ref_count(p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
- talloc_free(p1);
+ talloc_unlink(NULL, p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
talloc_unlink(NULL, p1);
@@ -383,7 +383,7 @@ static bool test_misc(void)
"failed: talloc_unlink() of non-reference context should return -1\n");
torture_assert("misc", talloc_unlink(p1, p2) == 0,
"failed: talloc_unlink() of parent should succeed\n");
- talloc_free(p1);
+ talloc_unlink(NULL, p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
@@ -542,14 +542,18 @@ static bool test_realloc(void)
talloc_realloc_size(NULL, p2, 0);
talloc_realloc_size(NULL, p2, 0);
+ CHECK_BLOCKS("realloc", p1, 4);
+ talloc_realloc_size(p1, p2, 0);
CHECK_BLOCKS("realloc", p1, 3);
torture_assert("realloc", talloc_realloc_size(NULL, p1, 0x7fffffff) == NULL,
"failed: oversize talloc should fail\n");
talloc_realloc_size(NULL, p1, 0);
-
+ CHECK_BLOCKS("realloc", root, 4);
+ talloc_realloc_size(root, p1, 0);
CHECK_BLOCKS("realloc", root, 1);
+
CHECK_SIZE("realloc", root, 0);
talloc_free(root);
@@ -868,7 +872,7 @@ static bool test_lifeless(void)
(void)talloc_reference(child_owner, child);
talloc_report_full(top, stderr);
talloc_unlink(top, parent);
- talloc_free(child);
+ talloc_unlink(top, child);
talloc_report_full(top, stderr);
talloc_free(top);
talloc_free(child_owner);