hw/ppc/mac_newworld: Free openpic_irqs array after use
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 1 Nov 2018 16:17:58 +0000 (16:17 +0000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 8 Nov 2018 01:04:40 +0000 (12:04 +1100)
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

index a630cb81cd8485bcea6d593ffcde5c5967a35456..14273a123e5278da0f8bf39cc260f1ae8c2faeb2 100644 (file)
@@ -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 */