hw/ppc/pnv: drop extra ref on PHB after adding as child
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 <milesg@linux.ibm.com> Reviewed-by: Aditya Gupta <adityag@linux.ibm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
Apr 27, 2026 at 16:26 UTC
e7b1bb6d22a17339df9ed0ddf3d81382c1856978
1 file changed
+1
hw/ppc/pnv.c
+1
@@ -1696,6 +1696,7 @@ static void pnv_chip_power8_instance_init(Object *obj)
1696
*/
1697
object_property_add_child(obj, "phb[*]", phb);
1698
chip8->phbs[i] = PNV_PHB(phb);
1699
+ object_unref(phb);
1700
}
1701
}
1702