]> Git Repo - qemu.git/commitdiff
sev/i386: fix memory leak in sev_guest_init()
authorGreg Kurz <[email protected]>
Thu, 29 Mar 2018 09:10:21 +0000 (11:10 +0200)
committerEduardo Habkost <[email protected]>
Tue, 3 Apr 2018 02:05:26 +0000 (23:05 -0300)
The string returned by object_property_get_str() is dynamically allocated.

Fixes: d8575c6c0242b
Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <152231462116.69730.14119625999092384450[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
target/i386/sev.c

index 019d84cef2c7251ff8bfea6893eb834ac07af1e3..c01167143f1c702f66b5ad2431508463106e2a1a 100644 (file)
@@ -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);
This page took 0.02729 seconds and 4 git commands to generate.