From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>,
Greg Kurz <groug@kaod.org>
Subject: [Qemu-devel] [PULL 2/2] sev/i386: fix memory leak in sev_guest_init()
Date: Tue, 3 Apr 2018 11:01:07 -0300 [thread overview]
Message-ID: <20180403140107.26125-3-ehabkost@redhat.com> (raw)
In-Reply-To: <20180403140107.26125-1-ehabkost@redhat.com>
From: Greg Kurz <groug@kaod.org>
The string returned by object_property_get_str() is dynamically allocated.
Fixes: d8575c6c0242b
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <152231462116.69730.14119625999092384450.stgit@bahia.lan>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
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 019d84cef2..c01167143f 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);
--
2.14.3
next prev parent reply other threads:[~2018-04-03 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 14:01 [Qemu-devel] [PULL 0/2] Fix memory leaks when using object_property_get_str() Eduardo Habkost
2018-04-03 14:01 ` [Qemu-devel] [PULL 1/2] exec: fix memory leak in find_max_supported_pagesize() Eduardo Habkost
2018-04-03 14:01 ` Eduardo Habkost [this message]
2018-04-04 11:33 ` [Qemu-devel] [PULL 0/2] Fix memory leaks when using object_property_get_str() 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=20180403140107.26125-3-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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).