On 28/04/26 01:12, Marc-André Lureau wrote:

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")
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 524563dcfc2..476255b722f 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1590,6 +1590,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);
          }
      }

Reviewed-by: Aditya Gupta <[email protected]>


Thanks,

- Aditya G


Reply via email to