Re:Talloc: The Tutorial
by huhtenberg on Sunday December 08, 2013 @08:10AM
(#6869616)
Too simple ;)
[ Parent
| on HN ]
Yep, you can also do
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.
Re:Talloc: The Tutorial
by huhtenberg on Sunday December 08, 2013 @08:53AM
(#6869685)
I'm not going anywhere. Double-free is a known pitfall. People watch for it and a lot of standard libraries have safeguards against it.
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.