From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb6YR-0001If-OQ for qemu-devel@nongnu.org; Thu, 15 Dec 2011 03:20:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rb6YN-0005dc-7k for qemu-devel@nongnu.org; Thu, 15 Dec 2011 03:20:39 -0500 Received: from cantor2.suse.de ([195.135.220.15]:59873 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rb6YM-0005d4-Vb for qemu-devel@nongnu.org; Thu, 15 Dec 2011 03:20:35 -0500 Message-ID: <4EE9AD8E.50608@suse.de> Date: Thu, 15 Dec 2011 09:19:26 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <4EE9AB5A.4080306@linux.vnet.ibm.com> In-Reply-To: <4EE9AB5A.4080306@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] some questions about g_malloc in qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Hui Li Cc: Kevin Wolf , zhihuili@cn.ibm.com, QEMU-devel , Stefan Hajnoczi Am 15.12.2011 09:10, schrieb Zhi Hui Li: >=20 > 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-ma= lloc 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg