qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] some questions about g_malloc in qemu


From: Andreas Färber
Subject: Re: [Qemu-devel] some questions about g_malloc in qemu
Date: Thu, 15 Dec 2011 09:19:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0

Am 15.12.2011 09:10, schrieb Zhi Hui Li:
> 
> I am not sure  whether it is  need to check the return of g_malloc  in
> qemu  ?

Compare the glib manual:

http://developer.gnome.org/glib/2.30/glib-Memory-Allocation.html#g-malloc

http://developer.gnome.org/glib/2.30/glib-Memory-Allocation.html#g-try-malloc

So, g_malloc() may return NULL if the requested size is zero, and it may
abort but does not return NULL due to insufficient memory available.

HTH,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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