summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorAndreas Färber2014-06-18 09:55:18 +0200
committerAndreas Färber2014-06-30 21:13:30 +0200
commitf3c7d0389fe8a2792fd4c1cf151b885de03c8f62 (patch)
tree17a37a957d51c956c3c9e98b8e4cdd6ac1adf3dd /hw/core
parentsdhci: Fix misuse of qemu_free_irqs() (diff)
downloadqemu-f3c7d0389fe8a2792fd4c1cf151b885de03c8f62.tar.gz
qemu-f3c7d0389fe8a2792fd4c1cf151b885de03c8f62.tar.xz
qemu-f3c7d0389fe8a2792fd4c1cf151b885de03c8f62.zip
hw: Fix qemu_allocate_irqs() leaks
Replace qemu_allocate_irqs(foo, bar, 1)[0] with qemu_allocate_irq(foo, bar, 0). This avoids leaking the dereferenced qemu_irq *. Cc: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <afaerber@suse.de> [PC Changes: * Applied change to instance in sh4/sh7750.c ] Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Kirill Batuzov <batuzovk@ispras.ru> [AF: Fix IRQ index in sh4/sh7750.c] Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/irq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/core/irq.c b/hw/core/irq.c
index 03c8cb31ea..3d284c6482 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -102,7 +102,7 @@ qemu_irq qemu_irq_invert(qemu_irq irq)
{
/* The default state for IRQs is low, so raise the output now. */
qemu_irq_raise(irq);
- return qemu_allocate_irqs(qemu_notirq, irq, 1)[0];
+ return qemu_allocate_irq(qemu_notirq, irq, 0);
}
static void qemu_splitirq(void *opaque, int line, int level)
@@ -117,7 +117,7 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
qemu_irq *s = g_malloc0(2 * sizeof(qemu_irq));
s[0] = irq1;
s[1] = irq2;
- return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];
+ return qemu_allocate_irq(qemu_splitirq, s, 0);
}
static void proxy_irq_handler(void *opaque, int n, int level)