From: Cornelia Huck <cohuck@redhat.com>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Alexander Graf <agraf@suse.de>,
David Hildenbrand <david@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
qemu-s390x@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize()
Date: Thu, 29 Mar 2018 11:18:31 +0200 [thread overview]
Message-ID: <20180329111831.2ffad2bd.cohuck@redhat.com> (raw)
In-Reply-To: <152231458624.69730.1752893648612848392.stgit@bahia.lan>
On Thu, 29 Mar 2018 11:09:46 +0200
Greg Kurz <groug@kaod.org> wrote:
> The string returned by object_property_get_str() is dynamically allocated.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> exec.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/exec.c b/exec.c
> index c09bd93df31e..02b1efebb7c3 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1495,6 +1495,7 @@ static int find_max_supported_pagesize(Object *obj, void *opaque)
> mem_path = object_property_get_str(obj, "mem-path", NULL);
> if (mem_path) {
> long hpsize = qemu_mempath_getpagesize(mem_path);
> + g_free(mem_path);
> if (hpsize < *hpsize_min) {
> *hpsize_min = hpsize;
> }
>
Personally, I'd probably do the g_free() at the end of the if
(mem_path) branch, but this works as well.
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
next prev parent reply other threads:[~2018-03-29 9:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 9:09 [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() Greg Kurz
2018-03-29 9:09 ` [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize() Greg Kurz
2018-03-29 9:18 ` Cornelia Huck [this message]
2018-03-29 9:44 ` Greg Kurz
2018-03-29 11:47 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03 2:06 ` [Qemu-devel] " Eduardo Habkost
2018-03-29 9:10 ` [Qemu-devel] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev() Greg Kurz
2018-03-29 9:20 ` Cornelia Huck
2018-03-29 9:27 ` Igor Mammedov
2018-03-29 9:28 ` Cornelia Huck
2018-03-29 9:39 ` Greg Kurz
2018-03-29 10:31 ` Cornelia Huck
2018-03-29 11:49 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-03-29 11:50 ` Thomas Huth
2018-03-29 12:09 ` [Qemu-devel] " Cornelia Huck
2018-03-29 9:10 ` [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() Greg Kurz
2018-03-29 9:24 ` Cornelia Huck
2018-03-29 10:27 ` Greg Kurz
2018-03-29 11:56 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03 2:07 ` [Qemu-devel] " Eduardo Habkost
2018-03-31 6:39 ` [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() no-reply
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=20180329111831.2ffad2bd.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=crosthwaite.peter@gmail.com \
--cc=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=rth@twiddle.net \
/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).