qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 23/29] hw/arm/nseries.c: Fix memory leak spotted by


From: Shannon Zhao
Subject: [Qemu-devel] [PATCH 23/29] hw/arm/nseries.c: Fix memory leak spotted by valgrind
Date: Thu, 28 May 2015 20:08:46 +0800

From: Shannon Zhao <address@hidden>

valgrind complains about:
==4835== 8 bytes in 1 blocks are definitely lost in loss record 509 of 3,278
==4835==    at 0x4C2845D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4835==    by 0x354793: malloc_and_trace (vl.c:2556)
==4835==    by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==4835==    by 0x3ED98F: qemu_extend_irqs (irq.c:55)
==4835==    by 0x3EDA1B: qemu_allocate_irqs (irq.c:64)
==4835==    by 0x280261: n8x0_gpio_setup (nseries.c:136)
==4835==    by 0x2830AB: n8x0_init (nseries.c:1337)
==4835==    by 0x2832D6: n800_init (nseries.c:1409)
==4835==    by 0x358B5E: main (vl.c:4249)

Signed-off-by: Shannon Zhao <address@hidden>
Signed-off-by: Shannon Zhao <address@hidden>
---
 hw/arm/nseries.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index d243159..2e392a9 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -133,8 +133,8 @@ static void n800_mmc_cs_cb(void *opaque, int line, int 
level)
 
 static void n8x0_gpio_setup(struct n800_s *s)
 {
-    qemu_irq *mmc_cs = qemu_allocate_irqs(n800_mmc_cs_cb, s->mpu->mmc, 1);
-    qdev_connect_gpio_out(s->mpu->gpio, N8X0_MMC_CS_GPIO, mmc_cs[0]);
+    qemu_irq mmc_cs = qemu_allocate_irq(n800_mmc_cs_cb, s->mpu->mmc, 0);
+    qdev_connect_gpio_out(s->mpu->gpio, N8X0_MMC_CS_GPIO, mmc_cs);
 
     qemu_irq_lower(qdev_get_gpio_in(s->mpu->gpio, N800_BAT_COVER_GPIO));
 }
-- 
2.0.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]