Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 2008 08:22:51 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Bakul Shah <bakul@bitblocks.com>
Cc:        Garrett Cooper <yanefbsd@gmail.com>, hackers@freebsd.org
Subject:   Re: Fwd: strdup(NULL) supposed to create SIGSEGV? 
Message-ID:  <20080424082155.G10114@fledge.watson.org>
In-Reply-To: <20080423185431.3FA615BB1@mail.bitblocks.com>
References:  <20080423185431.3FA615BB1@mail.bitblocks.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080424082155.G10114>