Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2006 18:23:19 +0200
From:      Johannes Weiner <hnazfoo@googlemail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Return value of malloc(0)
Message-ID:  <20060629162319.GA94921@leiferikson.flosken.lan>
In-Reply-To: <m3bqsceyf2.fsf@merlin.emma.line.org>
References:  <20060628181045.GA54915@curry.mchp.siemens.de> <20060629054222.GA92895@leiferikson.flosken.lan> <m3bqsceyf2.fsf@merlin.emma.line.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 29, 2006 at 06:09:37PM +0200, Matthias Andree wrote:

> The value returned from malloc(0) must not be dereferenced whatever it
> was. It was 0x800, which doesn't count as "failure".

But this would be appropriate for catching the error:

if ((foo = malloc(0)) == foo)
	/* make noise */

wouldn't it?

Hannes

-- 
If the telephone rang today, water it!



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