Fwd: strdup(NULL) supposed to create SIGSEGV?

Robert Watson rwatson at FreeBSD.org
Thu Apr 24 07:22:52 UTC 2008


On Wed, 23 Apr 2008, Bakul Shah wrote:

> The *exception* is where a function is explicitly prepared to handle NULLs. 
> One must read its man page carefully and if it doesn't say anything about 
> how NULLs in place of ptrs are handled, one must not pass in NULLs!

While I recognize there are some useful consumer simplicity benefits to 
accepting NULL as an argument to free(3), it's always made me a bit uneasy for 
this reason.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-hackers mailing list