[09/10] hw/mips/mips_int.c: use qemu_allocate_irq to fix memory leak

Message ID 1435830563-3072-10-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao July 2, 2015, 9:49 a.m.
From: Shannon Zhao <shannon.zhao@linaro.org>

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/mips/mips_int.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c
index d740046..e463a46 100644
--- a/hw/mips/mips_int.c
+++ b/hw/mips/mips_int.c
@@ -59,12 +59,11 @@  static void cpu_mips_irq_request(void *opaque, int irq, int level)
 
 void cpu_mips_irq_init_cpu(CPUMIPSState *env)
 {
-    qemu_irq *qi;
     int i;
 
-    qi = qemu_allocate_irqs(cpu_mips_irq_request, mips_env_get_cpu(env), 8);
     for (i = 0; i < 8; i++) {
-        env->irq[i] = qi[i];
+        env->irq[i] = qemu_allocate_irq(cpu_mips_irq_request,
+                                        mips_env_get_cpu(env), i);
     }
 }