aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-06-06 17:22:58 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2017-06-08 11:05:31 +1000
commit8a9e0e7b890b2598da94646bf6a7272f3d3924de (patch)
tree4c572e21d44907915b09430852f545e2dd674c78
parent2d3e302ec2246d703ffa8d8f8769a3fa448d8145 (diff)
downloadqemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.zip
qemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.tar.gz
qemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.tar.bz2
spapr: fix memory leak in spapr_memory_pre_plug()
The string returned by object_property_get_str() is dynamically allocated. (Spotted by Coverity, CID 1375942) Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--hw/ppc/spapr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 91b4057..9b7ae28 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2615,8 +2615,11 @@ static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
if (mem_dev && !kvmppc_is_mem_backend_page_size_ok(mem_dev)) {
error_setg(errp, "Memory backend has bad page size. "
"Use 'memory-backend-file' with correct mem-path.");
- return;
+ goto out;
}
+
+out:
+ g_free(mem_dev);
}
struct sPAPRDIMMState {