summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-11-05 12:20:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:31 -0500
commit438a54b8b4df147405bba0b3b55a895d81a27b8a (patch)
tree4b929a469a56952371da37ce5a82afe024ebaebd /source4/torture
parent8a5c9c28410ae0320356fe1686ad0ee7d1ec0e7b (diff)
downloadsamba-438a54b8b4df147405bba0b3b55a895d81a27b8a.tar.gz
samba-438a54b8b4df147405bba0b3b55a895d81a27b8a.tar.bz2
samba-438a54b8b4df147405bba0b3b55a895d81a27b8a.zip
r3553: Allow talloc_reference to take a NULL pointer for the "ptr" argument.
This allows potentially NULL pointers to be referenced, without an if () for every use. (previously, it would segfault). Update doco, and allow talloc_unlink to match. Andrew Bartlett (This used to be commit 59757c7f9d0e08e3acacfb3116f6205057d5b119)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/local/talloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source4/torture/local/talloc.c b/source4/torture/local/talloc.c
index 348b037753..2eedb2b9b0 100644
--- a/source4/torture/local/talloc.c
+++ b/source4/torture/local/talloc.c
@@ -117,6 +117,11 @@ static BOOL test_ref1(void)
talloc_free(r1);
talloc_report_full(NULL, stdout);
+ printf("Testing NULL\n");
+ if (talloc_reference(root, NULL)) {
+ return False;
+ }
+
CHECK_BLOCKS(root, 1);
CHECK_SIZE(root, 0);
@@ -478,7 +483,12 @@ static BOOL test_misc(void)
talloc_unlink(NULL, p2);
talloc_unlink(root, p1);
-
+ /* Test that talloc_unlink is a no-op */
+
+ if (talloc_unlink(root, NULL) != -1) {
+ printf("failed: talloc_unlink(root, NULL) == -1\n");
+ return False;
+ }
talloc_report(root, stdout);
talloc_report(NULL, stdout);