qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends
Date: Tue, 01 Dec 2009 15:47:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Lightning/1.0pre Thunderbird/3.0b4

On 12/01/09 15:08, Markus Armbruster wrote:
For what it's worth, it violates the spec for malloc().  For zero-sized
allocations, we may either return a null pointer (but we already decided
we don't want to), or an object different from any other object alive.

Which clearly rules out the fixed memory location for malloc(0).

"malloc(size ? size : 1)" is indeed the easiest way to make sure we conform to the spec and also don't return NULL.

cheers,
  Gerd





reply via email to

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