diff mbox

[19/29] hw/openrisc/pic_cpu.c: Fix memory leak spotted by valgrind

Message ID 1432814932-12608-20-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao May 28, 2015, 12:08 p.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

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 <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/openrisc/pic_cpu.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

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);
 }