diff options
author | Greg Kurz | 2017-06-06 17:22:58 +0200 |
---|---|---|
committer | David Gibson | 2017-06-08 03:05:31 +0200 |
commit | 8a9e0e7b890b2598da94646bf6a7272f3d3924de (patch) | |
tree | 4c572e21d44907915b09430852f545e2dd674c78 /hw/ppc | |
parent | target/ppc: fix memory leak in kvmppc_is_mem_backend_page_size_ok() (diff) | |
download | qemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.tar.gz qemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.tar.xz qemu-8a9e0e7b890b2598da94646bf6a7272f3d3924de.zip |
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>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 91b4057933..9b7ae28939 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 { |