[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/29] hw/sparc/leon3.c: Fix memory leak spotted by
From: |
Shannon Zhao |
Subject: |
[Qemu-devel] [PATCH 09/29] hw/sparc/leon3.c: Fix memory leak spotted by valgrind |
Date: |
Thu, 28 May 2015 20:08:32 +0800 |
From: Shannon Zhao <address@hidden>
valgrind complains about:
==21199== 2,468 (128 direct, 2,340 indirect) bytes in 1 blocks are definitely
lost in loss record 1,094 of 1,125
==21199== at 0x4C2845D: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21199== by 0x21B933: malloc_and_trace (vl.c:2556)
==21199== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==21199== by 0x2700D3: qemu_extend_irqs (irq.c:55)
==21199== by 0x27015F: qemu_allocate_irqs (irq.c:64)
==21199== by 0x1ED14D: grlib_irqmp_create (grlib.h:64)
==21199== by 0x1ED6B9: leon3_generic_hw_init (leon3.c:142)
==21199== by 0x21FCFE: main (vl.c:4249)
Signed-off-by: Shannon Zhao <address@hidden>
Signed-off-by: Shannon Zhao <address@hidden>
---
hw/sparc/leon3.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 7f5dcd6..c449b39 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -111,7 +111,7 @@ static void leon3_generic_hw_init(MachineState *machine)
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *prom = g_new(MemoryRegion, 1);
- int ret;
+ int ret, i;
char *filename;
qemu_irq *cpu_irqs = NULL;
int bios_size;
@@ -214,6 +214,13 @@ static void leon3_generic_hw_init(MachineState *machine)
if (serial_hds[0]) {
grlib_apbuart_create(0x80000100, serial_hds[0], cpu_irqs[3]);
}
+
+ for (i = 0; i < MAX_PILS; i++) {
+ if ((i != 3) || (i != 6) || (i != 7)) {
+ qemu_free_irq(cpu_irqs[i]);
+ }
+ }
+ g_free(cpu_irqs);
}
static QEMUMachine leon3_generic_machine = {
--
2.0.4
- [Qemu-devel] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 09/29] hw/sparc/leon3.c: Fix memory leak spotted by valgrind,
Shannon Zhao <=
- [Qemu-devel] [PATCH 05/29] hw/isa/lpc_ich9.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 10/29] hw/sparc/sun4m.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 08/29] hw/intc/exynos4210_gic.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 18/29] hw/m68k/mcf5206.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 17/29] hw/lm32/milkymist.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 16/29] hw/lm32/lm32_boards.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 12/29] hw/ppc/ppc440_bamboo.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 15/29] hw/mips/mips_jazz.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 07/29] hw/timer/arm_timer.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28
- [Qemu-devel] [PATCH 13/29] hw/ppc/prep.c: Fix memory leak spotted by valgrind, Shannon Zhao, 2015/05/28