diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-12-22 15:29:37 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-01-05 06:37:07 +0100 |
commit | 66db49e35f87f0e0a9d82cfa661d2cc604758406 (patch) | |
tree | b7601aa707af3c925e4a354e828a7955f278f51a /lib/talloc | |
parent | 26c8a520f3284391820424df2bf4158b276dd32b (diff) | |
download | samba-66db49e35f87f0e0a9d82cfa661d2cc604758406.tar.gz |
talloc: added a test for the use after free Rusty found
Diffstat (limited to 'lib/talloc')
-rw-r--r-- | lib/talloc/testsuite.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c index 0026931d260..ee6256b8e1b 100644 --- a/lib/talloc/testsuite.c +++ b/lib/talloc/testsuite.c @@ -1167,6 +1167,21 @@ static bool test_free_ref_null_context(void) return true; } +static bool test_rusty(void) +{ + void *root; + const char *p1; + + talloc_enable_null_tracking(); + root = talloc_new(NULL); + p1 = talloc_strdup(root, "foo"); + talloc_increase_ref_count(p1); + talloc_report_full(root, stdout); + talloc_free(root); + return true; +} + + static void test_reset(void) { talloc_set_log_fn(test_log_stdout); @@ -1221,6 +1236,8 @@ bool torture_local_talloc(struct torture_context *tctx) ret &= test_pool(); test_reset(); ret &= test_free_ref_null_context(); + test_reset(); + ret &= test_rusty(); if (ret) { test_reset(); |