The problem is that level3 disappears, it's not reachable from
the null_context anymore. level3 and level5 get into a parent child loop.
I think the correct fix should be that level0 becomes the parent
of level3 after talloc_free(level1).
metze
static int _test_talloc_free_in_destructor(void **ptr)
{
+ printf("_test_talloc_free_in_destructor\n");
talloc_free(*ptr);
return 0;
}
talloc_set_destructor(level5, _test_talloc_free_in_destructor);
+ talloc_report_full(NULL, stderr);
+ printf("free level1\n");
talloc_free(level1);
+ talloc_report_full(NULL, stderr);
+ talloc_report_full(level3, stderr);
+ printf("free level0\n");
talloc_free(level0);
+ talloc_report_full(NULL, stderr);
+
printf("success: free_in_destructor\n");
return true;
}