Hi,
On Fri, 8 Sep 2006 16:02:57 +0200 Clemens Kirchgatterer clemens@1541.org wrote:
Changing the "free(aux);" to "if(aux) free(aux);" would probably care for that (resembling the earlier behaviour).
code like: if (bla) free(bla); will actually _never_ fix any bug. either bla is a valid pointer and can be free'ed or bla is NULL and the free does not hurt anyway, because one is explicitely allowed to free NULL pointers by the standard.
Yep, you're right. My mistake was not taking glibc private data into account and just using that "if" to check if it has been freed before. Of course, this only works partially. It's only duct tape for that bug... The free() *does* hurt, however. The standard tells us not to free a pointer twice (in fact, the man page suggests that "undefined behaviour occurs"). That's why there is this "double free assertion", I think. But what my solution suggested was just a circumvention of that assertion, not the bug itself. An ugly hack, that is agreed, not fixing the bug, but making the software, errrr, work :-)
-hwh