[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix qemu_malloc() error check for size==0

From: Jamie Lokier
Subject: Re: [Qemu-devel] [PATCH] fix qemu_malloc() error check for size==0
Date: Tue, 19 May 2009 21:31:00 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Eduardo Habkost wrote:
> I really hope you are not proposing to make qemu_realloc(p, 0) work but
> qemu_malloc(0) fail, because you would be breaking lots of
> realloc()/malloc() equivalency assumptions.


realloc(p, 0) *always* frees p (or does nothing if p == NULL), on all
systems complying with ISO C, and always returns NULL.

malloc(0) on the other hand does not guarantee this,
so malloc(0) is *not* a substitute for realloc(NULL, 0).

-- Jamie

reply via email to

[Prev in Thread] Current Thread [Next in Thread]