[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] hw/arm_timer: Fix memory leak (detected by Valg
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH 2/3] hw/arm_timer: Fix memory leak (detected by Valgrind) |
Date: |
Mon, 24 Sep 2012 21:08:49 +0200 |
qi was allocated using g_malloc and never released.
It is not necessary to use dynamic memory allocation
for qi because it is copied to entries in s->timer
and not used otherwise.
Signed-off-by: Stefan Weil <address@hidden>
---
hw/arm_timer.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index e3ecce2..9e5f892 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -269,9 +269,8 @@ static const VMStateDescription vmstate_sp804 = {
static int sp804_init(SysBusDevice *dev)
{
sp804_state *s = FROM_SYSBUS(sp804_state, dev);
- qemu_irq *qi;
-
- qi = qemu_allocate_irqs(sp804_set_irq, s, 2);
+ qemu_irq qi[2];
+ qemu_init_irqs(sp804_set_irq, s, qi, ARRAY_SIZE(qi));
sysbus_init_irq(dev, &s->irq);
s->timer[0] = arm_timer_init(s->freq0);
s->timer[1] = arm_timer_init(s->freq1);
--
1.7.10