From: Zhi Hui Li <zhihuili@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: QEMU-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] some questions about g_malloc in qemu
Date: Thu, 15 Dec 2011 17:48:16 +0800 [thread overview]
Message-ID: <4EE9C260.20305@linux.vnet.ibm.com> (raw)
In-Reply-To: <20111215093637.GA387@stefanha-thinkpad.localdomain>
On 2011年12月15日 17:36, Stefan Hajnoczi wrote:
> On Thu, Dec 15, 2011 at 04:28:28PM +0800, 陳韋任 wrote:
>> I found this in HACKING:
>>
>> Please note that NULL check for the g_malloc result is redundant and
>> that g_malloc() call with zero size is not allowed.
>
> So we have:
>
> 1. You should not request 0 bytes from g_malloc().
> 2. g_malloc() does not return NULL (if you follow rule #1).
>
> There is no need to check for NULL return.
>
> Stefan
>
>
Maybe there is insufficient memory, the return is error,
Do we need to check the return ?
Thank you very much for your feedback!
next prev parent reply other threads:[~2011-12-15 9:48 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
2011-12-15 8:28 ` 陳韋任
2011-12-15 9:36 ` Stefan Hajnoczi
2011-12-15 9:48 ` Zhi Hui Li [this message]
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=4EE9C260.20305@linux.vnet.ibm.com \
--to=zhihuili@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).