From: Marc-André Lureau <[email protected]>
object_new() returns an object with refcount 1, and
object_property_add_child() adds another reference. The initial
reference must be dropped so the parent becomes the sole owner,
otherwise the PHB objects leak when the chip is destroyed.
Fixes: 0d512c7120a2 ("ppc/pnv: turn chip8->phbs[] into a PnvPHB* array")
Reviewed-by: Glenn Miles <[email protected]>
Reviewed-by: Aditya Gupta <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
---
hw/ppc/pnv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 9ed918fa6a1..8306754d9ad 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1696,6 +1696,7 @@ static void pnv_chip_power8_instance_init(Object *obj)
*/
object_property_add_child(obj, "phb[*]", phb);
chip8->phbs[i] = PNV_PHB(phb);
+ object_unref(phb);
}
}
--
2.54.0