From: Paolo Bonzini <pbonzini@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>
Cc: "qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Marcel Apfelbaum <marcel.a@redhat.com>
Subject: Re: [Qemu-trivial] [PATCH/RFC] vl.c: fix memory leak spotted by valgrind
Date: Wed, 28 Jan 2015 16:18:55 +0100 [thread overview]
Message-ID: <54C8FDDF.6010300@redhat.com> (raw)
In-Reply-To: <1422457637-45862-1-git-send-email-borntraeger@de.ibm.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
and Ccing qemu-trivial. Funny that we do the g_slist_free before exiting!
Paolo
On 28/01/2015 16:07, Christian Borntraeger wrote:
> valgrind complains about:
> ==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 1,048
> ==42062== at 0x402DCB2: malloc (vg_replace_malloc.c:299)
> ==42062== by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x40DA133: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x40DB2E5: g_slist_prepend (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x801637FF: object_class_get_list_tramp (object.c:690)
> ==42062== by 0x40A96C9: g_hash_table_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x80164885: object_class_foreach (object.c:665)
> ==42062== by 0x80164975: object_class_get_list (object.c:698)
> ==42062== by 0x800100A5: machine_parse (vl.c:2447)
> ==42062== by 0x800100A5: main (vl.c:3756)
>
> Lets free machines in case of mc.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> vl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/vl.c b/vl.c
> index 983259b..9d008ac 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b)
> mc = find_machine(name);
> }
> if (mc) {
> + g_slist_free(machines);
> return mc;
> }
> if (name && !is_help_option(name)) {
>
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>
Cc: "qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Marcel Apfelbaum <marcel.a@redhat.com>
Subject: Re: [Qemu-devel] [PATCH/RFC] vl.c: fix memory leak spotted by valgrind
Date: Wed, 28 Jan 2015 16:18:55 +0100 [thread overview]
Message-ID: <54C8FDDF.6010300@redhat.com> (raw)
In-Reply-To: <1422457637-45862-1-git-send-email-borntraeger@de.ibm.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
and Ccing qemu-trivial. Funny that we do the g_slist_free before exiting!
Paolo
On 28/01/2015 16:07, Christian Borntraeger wrote:
> valgrind complains about:
> ==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 1,048
> ==42062== at 0x402DCB2: malloc (vg_replace_malloc.c:299)
> ==42062== by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x40DA133: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x40DB2E5: g_slist_prepend (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x801637FF: object_class_get_list_tramp (object.c:690)
> ==42062== by 0x40A96C9: g_hash_table_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2)
> ==42062== by 0x80164885: object_class_foreach (object.c:665)
> ==42062== by 0x80164975: object_class_get_list (object.c:698)
> ==42062== by 0x800100A5: machine_parse (vl.c:2447)
> ==42062== by 0x800100A5: main (vl.c:3756)
>
> Lets free machines in case of mc.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> vl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/vl.c b/vl.c
> index 983259b..9d008ac 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b)
> mc = find_machine(name);
> }
> if (mc) {
> + g_slist_free(machines);
> return mc;
> }
> if (name && !is_help_option(name)) {
>
next prev parent reply other threads:[~2015-01-28 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 15:07 [Qemu-devel] [PATCH/RFC] vl.c: fix memory leak spotted by valgrind Christian Borntraeger
2015-01-28 15:18 ` Paolo Bonzini [this message]
2015-01-28 15:18 ` Paolo Bonzini
2015-02-07 9:03 ` [Qemu-trivial] " Michael Tokarev
2015-02-07 9:03 ` [Qemu-devel] " Michael Tokarev
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=54C8FDDF.6010300@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=marcel.a@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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.