[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug()
From: |
Greg Kurz |
Subject: |
[Qemu-ppc] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug() |
Date: |
Tue, 06 Jun 2017 17:22:58 +0200 |
User-agent: |
StGit/0.17.1-20-gc0b1b-dirty |
The string returned by object_property_get_str() is dynamically allocated.
(Spotted by Coverity, CID 1375942)
Signed-off-by: Greg Kurz <address@hidden>
---
hw/ppc/spapr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 86e622834f63..f834a6a7dfac 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2617,8 +2617,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 {
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 1/3] target/ppc: pass const pointer to kvmppc_is_mem_backend_page_size_ok(), (continued)
- [Qemu-ppc] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug(),
Greg Kurz <=
- Re: [Qemu-ppc] [PATCH 0/3] ppc: fix memory leaks, David Gibson, 2017/06/06