qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 19/29] hw/openrisc/pic_cpu.c: Fix memory leak spotte


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

From: Shannon Zhao <address@hidden>

valgrind complains about:
==2442== 256 bytes in 1 blocks are definitely lost in loss record 803 of 952
==2442==    at 0x4C2845D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2442==    by 0x1E22A7: malloc_and_trace (vl.c:2556)
==2442==    by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==2442==    by 0x22FF53: qemu_extend_irqs (irq.c:55)
==2442==    by 0x22FFDF: qemu_allocate_irqs (irq.c:64)
==2442==    by 0x1BCBBE: cpu_openrisc_pic_init (pic_cpu.c:55)
==2442==    by 0x1BD3BA: openrisc_sim_init (openrisc_sim.c:121)
==2442==    by 0x1E6672: main (vl.c:4249)

Signed-off-by: Shannon Zhao <address@hidden>
Signed-off-by: Shannon Zhao <address@hidden>
---
 hw/openrisc/pic_cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/openrisc/pic_cpu.c b/hw/openrisc/pic_cpu.c
index 2af1d60..8347f5c 100644
--- a/hw/openrisc/pic_cpu.c
+++ b/hw/openrisc/pic_cpu.c
@@ -57,4 +57,5 @@ void cpu_openrisc_pic_init(OpenRISCCPU *cpu)
     for (i = 0; i < NR_IRQS; i++) {
         cpu->env.irq[i] = qi[i];
     }
+    g_free(qi);
 }
-- 
2.0.4





reply via email to

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