diff mbox series

[PULL,15/22] hw/ppc/mac_newworld: Free openpic_irqs array after use

Message ID 20181108121646.26173-16-david@gibson.dropbear.id.au
State Accepted
Commit 1bbd6272a18d6fe3390d4b4200a1a7a566b304fa
Headers show
Series None | expand

Commit Message

David Gibson Nov. 8, 2018, 12:16 p.m. UTC
From: Peter Maydell <peter.maydell@linaro.org>


In ppc_core99_init(), we allocate an openpic_irqs array, which
we then use to collect up the various qemu_irqs which we're
going to connect to the interrupt controller. Once we've
called sysbus_connect_irq() to connect them all up, the
array is no longer required, but we forgot to free it.

Since board init is only run once at startup, the memory
leak is not a significant one.

Spotted by Coverity: CID 1192916.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

---
 hw/ppc/mac_newworld.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.19.1
diff mbox series

Patch

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index a630cb81cd..14273a123e 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -303,6 +303,7 @@  static void ppc_core99_init(MachineState *machine)
             sysbus_connect_irq(s, k++, openpic_irqs[i][j]);
         }
     }
+    g_free(openpic_irqs);
 
     if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
         /* 970 gets a U3 bus */