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 3/3] sev/i386: fix memory leak in sev_guest_init()
Date: Thu, 29 Mar 2018 11:24:16 +0200 [thread overview]
Message-ID: <20180329112416.28b99184.cohuck@redhat.com> (raw)
In-Reply-To: <152231462116.69730.14119625999092384450.stgit@bahia.lan>
On Thu, 29 Mar 2018 11:10:21 +0200
Greg Kurz <groug@kaod.org> wrote:
> The string returned by object_property_get_str() is dynamically allocated.
>
> Fixes: d8575c6c0242b
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> target/i386/sev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 019d84cef2c7..c01167143f1c 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -748,9 +748,11 @@ sev_guest_init(const char *id)
> if (s->sev_fd < 0) {
> error_report("%s: Failed to open %s '%s'", __func__,
> devname, strerror(errno));
> - goto err;
> }
> g_free(devname);
> + if (s->sev_fd < 0) {
> + goto err;
> + }
>
> ret = sev_platform_ioctl(s->sev_fd, SEV_PLATFORM_STATUS, &status,
> &fw_error);
>
I would probably add an extra g_free(devname) right before the goto
err, but this works as well, obviously.
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
next prev parent reply other threads:[~2018-03-29 9:24 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
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 [this message]
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=20180329112416.28b99184.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).