summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2016-06-29 16:51:26 -0700
committerJeremy Allison <jra@samba.org>2016-07-03 14:26:17 +0200
commitd820b046ac76705eff9817b76e5830096c28768f (patch)
tree93cafdaa0895fa07c5fd6eae53bebb6f77283a8b /lib/talloc
parentf877191fee61bc066687154044c0af28e356ee27 (diff)
downloadsamba-d820b046ac76705eff9817b76e5830096c28768f.tar.gz
lib: talloc: Add check for destructor protection.
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/testsuite.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index dd49df1f982..8fe5d90f98a 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -1865,6 +1865,11 @@ static void test_magic_protection_abort(const char *reason)
}
}
+static int test_magic_protection_destructor(int *ptr)
+{
+ _exit(404); /* Not 42 */
+}
+
static bool test_magic_protection(void)
{
void *pool = talloc_pool(NULL, 1024);
@@ -1883,6 +1888,7 @@ static bool test_magic_protection(void)
pid = fork();
if (pid == 0) {
talloc_set_abort_fn(test_magic_protection_abort);
+ talloc_set_destructor(p2, test_magic_protection_destructor);
/*
* Simulate a security attack