From: "Andreas Färber" <afaerber@suse.de>
To: Zhi Hui Li <zhihuili@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
zhihuili@cn.ibm.com, QEMU-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] some questions about g_malloc in qemu
Date: Thu, 15 Dec 2011 09:19:26 +0100 [thread overview]
Message-ID: <4EE9AD8E.50608@suse.de> (raw)
In-Reply-To: <4EE9AB5A.4080306@linux.vnet.ibm.com>
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
next prev parent reply other threads:[~2011-12-15 8:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 8:10 [Qemu-devel] some questions about g_malloc in qemu Zhi Hui Li
2011-12-15 8:14 ` 陳韋任
2011-12-15 8:19 ` Andreas Färber [this message]
2011-12-15 8:28 ` 陳韋任
2011-12-15 9:36 ` Stefan Hajnoczi
2011-12-15 9:48 ` Zhi Hui Li
2011-12-15 9:56 ` 陳韋任
2011-12-15 10:02 ` Kevin Wolf
2011-12-15 10:19 ` Stefan Hajnoczi
2011-12-15 10:37 ` Max Filippov
2011-12-15 10:44 ` Kevin Wolf
2011-12-15 10:45 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE9AD8E.50608@suse.de \
--to=afaerber@suse.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=zhihuili@cn.ibm.com \
--cc=zhihuili@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.