Too simple ;)
void * p;
p = talloc(1, NULL);
talloc_set_parent(p, p);
tfree(p); void * p;
p = talloc(1, NULL);
talloc_set_parent(p, p);
tfree(p); void *p;
free(p);
free(p);
Don't get me wrong, I get where you are going. But C philosophy is that libraries shouldn't do expensive checking to detect programmers' errors.On the other hand tfree() hangs if a prior call to talloc_set_parent() is passed certain arguments. Just more ammunition to shoot one's own foot. (p, p) might be a degenerate case, but real code will create cyclic references. In such case blaming programmer is the least productive way to handle it.
Fixed! Thanks.