Return value of malloc(0)

Johannes Weiner hnazfoo at googlemail.com
Thu Jun 29 16:22:23 UTC 2006


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!


More information about the freebsd-hackers mailing list