[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha8-157-g34d6d7c
Andrew Tridgell
tridge at samba.org
Wed Jul 1 06:37:53 GMT 2009
The branch, master has been updated
via 34d6d7cec82c50ce7b36fec0051063f44fed5609 (commit)
via 3c2f4df55532b17ef4957604ffe411eb885edbaf (commit)
from 4fb1f8e8fe46b3e77c06612ac3fc3d67cf650a11 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 34d6d7cec82c50ce7b36fec0051063f44fed5609
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Jul 1 16:36:29 2009 +1000
fixed the talloc testsuite for the recent changes
commit 3c2f4df55532b17ef4957604ffe411eb885edbaf
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Jul 1 16:36:10 2009 +1000
a talloc_realloc() to zero size needs to use an unambiguous free
-----------------------------------------------------------------------
Summary of changes:
lib/talloc/talloc.c | 2 +-
lib/talloc/testsuite.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index bf2fb1f..e68b653 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1067,7 +1067,7 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
/* size zero is equivalent to free() */
if (unlikely(size == 0)) {
- talloc_free(ptr);
+ talloc_unlink(context, ptr);
return NULL;
}
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 3d490dd..248edfb 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);
--
Samba Shared Repository
More information about the samba-cvs
mailing list