aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-03-29 11:10:21 +0200
committerEduardo Habkost <ehabkost@redhat.com>2018-04-02 23:05:26 -0300
commit5d7bc72a4336f922ba42bab545529051c706ac4b (patch)
tree632d10f3fae33ccda45f0ec14387e4d6c979e898 /target
parent72a841d2a403b56ff894fa007b172dc9bcb3dae8 (diff)
downloadqemu-5d7bc72a4336f922ba42bab545529051c706ac4b.zip
qemu-5d7bc72a4336f922ba42bab545529051c706ac4b.tar.gz
qemu-5d7bc72a4336f922ba42bab545529051c706ac4b.tar.bz2
sev/i386: fix memory leak in sev_guest_init()
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>
Diffstat (limited to 'target')
-rw-r--r--target/i386/sev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 019d84c..c011671 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);