SOURCES (rpm-4_4_9): rpm-lualeak.patch - more _free() compatible, ...
Jeff Johnson
n3npq at mac.com
Mon Mar 17 22:57:26 CET 2008
On Mar 17, 2008, at 5:44 PM, Tomasz Wittner wrote:
>
> IMO construction like `if(foo) free(foo);' has little value (maybe
> is useful
> for performance reasons - conditional instruction vs. calling
> function - I
> don't know). I didn't write any piece of C code for ages, but it
> seems to me
> that you would like achieve rather sth like:
> if(_lua_init) { free(_lua_init); _lua_init = NULL; }
>
Heh, Real Men use reference counted garbage collected slab memory
memory with
a SAT solving loop breaker.
Meanwhile, you're looking at code out-of-context.
The snippet that is extracted came from rpm code that looks like
ptr = _free(ptr);
Whether free(NULL) is permitted (or not) is hardly the issue. The
stoopid _free() wrapper immediately poisons (by setting to NULL)
the pointer that used to reference malloc'd memory, thereby preventing
any possibility of accidentally referencing already free'd memory.
Those bugs are _REALLY_ hard to find, segfault's from looking through
a NULL pointer are easy pie fixing in comparison.
73 de Jeff
More information about the pld-devel-en
mailing list