Hi there, > Yeah I've tested before (because I used to want to think glibc would > check for that) and it definately segvs. I'll push this patch with > that added.
I'm a bit confused, this goes against everything I know about C memory management: ANSI C (ANSI X3J11/88-090, May 13, 1988) [1], Section 4.10.3.2: If ptr is a null pointer, no action occurs. ISO C (ISO/IEC 9899:TC3) [2], Section 7.20.3.2: If ptr is a null pointer, no action occurs. POSIX.1-2008 [3], free function definition: If ptr is a null pointer, no action shall occur. free(3) manpage, Linux: If ptr is NULL, no operation is performed. Test case (volatile to make the compiler not optimize it away): #include <stdlib.h> int main(int argc, char **argv) { void * volatile ptr = NULL; free(ptr); return 0; } Works fine on my system. I have yet to see an implementation of free() which does not implement this. Ok, maybe there is one from ancient times, but any current Linux library should have no problems with this, otherwise I would consider that to be a serious bug. A *lot* of code I've read through in lots of different open source projects actually relies on this fact. -- Christian [1] http://flash-gordon.me.uk/ansi.c.txt [2] http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf (Links from the respective Wikipedia pages) [3] http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel