1 /* failtest with valgrind caught this read-after-free. */
2 #include <ccan/talloc/talloc.c>
4 #include <ccan/tap/tap.h>
6 int main(int argc, char *argv[])
11 talloc_enable_null_tracking();
12 root = talloc_new(NULL);
13 p1 = talloc_strdup(root, "foo");
14 talloc_increase_ref_count(p1);
16 ok1(strcmp(p1, "foo") == 0);
17 talloc_unlink(NULL, p1);
19 /* This closes the leak, but make sure we're not freeing unexpected. */
20 ok1(!talloc_chunk_from_ptr(null_context)->child);
21 talloc_disable_null_tracking();