summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorGreg Kurz2017-05-19 12:32:04 +0200
committerDavid Gibson2017-05-24 03:39:53 +0200
commit249127d0dfeb2cf5e24d9353b6d54c91c1666ddc (patch)
tree2dd72cb66e2fe62e70ac59bd5e17214ad6f2f878 /hw
parenthw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry (diff)
downloadqemu-249127d0dfeb2cf5e24d9353b6d54c91c1666ddc.tar.gz
qemu-249127d0dfeb2cf5e24d9353b6d54c91c1666ddc.tar.xz
qemu-249127d0dfeb2cf5e24d9353b6d54c91c1666ddc.zip
spapr_cpu_core: drop reference on ICP object during CPU realization
When a piece of code allocates an object, it implicitely gets a reference on it. If it then makes that object a child property of another object, it should drop its own reference at some point otherwise the child object can never be finalized. The current code hence leaks one ICP object per CPU when hot-removing a core. Failing to add a newly allocated ICP object to the CPU is a bug. While here, let's ensure QEMU aborts if this ever happens. Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/spapr_cpu_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 1df1404ea5..ff7058ecc0 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -143,7 +143,8 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
Object *obj;
obj = object_new(spapr->icp_type);
- object_property_add_child(OBJECT(cpu), "icp", obj, NULL);
+ object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
+ object_unref(obj);
object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort);
object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {