From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org, Li Zhi Hui <zhihuili@linux.vnet.ibm.com>,
Mark Wu <wudxw@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] qemu-nbd.c : fix memory leak
Date: Fri, 02 Dec 2011 08:48:50 +0100 [thread overview]
Message-ID: <4ED882E2.6090709@redhat.com> (raw)
In-Reply-To: <4ED88173.2040505@weilnetz.de>
On 12/02/2011 08:42 AM, Stefan Weil wrote:
>>>
>>> - if (sharing_fds[0] == -1)
>>> + if (sharing_fds[0] == -1) {
>>> + g_free(sharing_fds);
>>> return 1;
>>> + }
>>>
>>> if (device) {
>>> int ret;
>> Zhihui,
>>
>> Kernel should free all memory used by the process after it exits. So
>> there's no memory leak even without explicit free.
>
> That's correct. Nevertheless fixing this helps to find other more important
> memory leaks with static or dynamic code analyzers like cppcheck or
> valgrind.
>
> Reviewed-by: Stefan Weil <sw@weilnetz.de>
Please hold off, I'm about to introduce large changes to qemu-nbd for
asynchronous I/O (including getting rid of sharing_fds in favor of the
main loop) and and I'd rather avoid gratuitous conflicts.
Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org, Li Zhi Hui <zhihuili@linux.vnet.ibm.com>,
Mark Wu <wudxw@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-nbd.c : fix memory leak
Date: Fri, 02 Dec 2011 08:48:50 +0100 [thread overview]
Message-ID: <4ED882E2.6090709@redhat.com> (raw)
In-Reply-To: <4ED88173.2040505@weilnetz.de>
On 12/02/2011 08:42 AM, Stefan Weil wrote:
>>>
>>> - if (sharing_fds[0] == -1)
>>> + if (sharing_fds[0] == -1) {
>>> + g_free(sharing_fds);
>>> return 1;
>>> + }
>>>
>>> if (device) {
>>> int ret;
>> Zhihui,
>>
>> Kernel should free all memory used by the process after it exits. So
>> there's no memory leak even without explicit free.
>
> That's correct. Nevertheless fixing this helps to find other more important
> memory leaks with static or dynamic code analyzers like cppcheck or
> valgrind.
>
> Reviewed-by: Stefan Weil <sw@weilnetz.de>
Please hold off, I'm about to introduce large changes to qemu-nbd for
asynchronous I/O (including getting rid of sharing_fds in favor of the
main loop) and and I'd rather avoid gratuitous conflicts.
Paolo
next prev parent reply other threads:[~2011-12-02 7:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 3:34 [Qemu-trivial] [PATCH] qemu-nbd.c : fix memory leak Li Zhi Hui
2011-12-02 3:34 ` [Qemu-devel] " Li Zhi Hui
2011-12-02 7:28 ` [Qemu-trivial] " Mark Wu
2011-12-02 7:28 ` Mark Wu
2011-12-02 7:42 ` [Qemu-trivial] " Stefan Weil
2011-12-02 7:42 ` Stefan Weil
2011-12-02 7:48 ` Paolo Bonzini [this message]
2011-12-02 7:48 ` Paolo Bonzini
2011-12-02 11:08 ` [Qemu-trivial] " Stefan Hajnoczi
2011-12-02 11:08 ` Stefan Hajnoczi
2011-12-02 7:53 ` Zhi Hui Li
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=4ED882E2.6090709@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=sw@weilnetz.de \
--cc=wudxw@linux.vnet.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.