]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
exec: fix memory leak in find_max_supported_pagesize()
authorGreg Kurz <groug@kaod.org>
Thu, 29 Mar 2018 09:09:46 +0000 (11:09 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 21 Jun 2018 01:45:01 +0000 (20:45 -0500)
The string returned by object_property_get_str() is dynamically allocated.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <152231458624.69730.1752893648612848392.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>
(cherry picked from commit 72a841d2a403b56ff894fa007b172dc9bcb3dae8)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c

diff --git a/exec.c b/exec.c
index 5f8017a5d72df3ee7490c6590cd9f46fb358a528..e60ad94a429e2d73e19cda41139f87c4c6902b82 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1455,6 +1455,7 @@ static int find_max_supported_pagesize(Object *obj, void *opaque)
         mem_path = object_property_get_str(obj, "mem-path", NULL);
         if (mem_path) {
             long hpsize = qemu_mempath_getpagesize(mem_path);
+            g_free(mem_path);
             if (hpsize < *hpsize_min) {
                 *hpsize_min = hpsize;
             }