Skip to content

Commit

Permalink
sev/i386: fix memory leak in sev_guest_init()
Browse files Browse the repository at this point in the history
The string returned by object_property_get_str() is dynamically allocated.

Fixes: d8575c6
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>
  • Loading branch information
gkurz authored and ehabkost committed Apr 3, 2018
1 parent 72a841d commit 5d7bc72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion target/i386/sev.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5d7bc72

Please sign in to comment.