diff mbox

[2/3] hw/ide/pci: Fix memory leak

Message ID 1432543077-12656-3-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao May 25, 2015, 8:37 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

valgrind complains about:
==16447== 16 bytes in 2 blocks are definitely lost in loss record 1,304 of 3,310
==16447==    at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==16447==    by 0x2E4FD7: malloc_and_trace (vl.c:2546)
==16447==    by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
==16447==    by 0x36FB47: qemu_extend_irqs (irq.c:55)
==16447==    by 0x36FBD3: qemu_allocate_irqs (irq.c:64)
==16447==    by 0x3B4B44: bmdma_init (pci.c:464)
==16447==    by 0x3B547B: pci_piix_init_ports (piix.c:144)
==16447==    by 0x3B55D2: pci_piix_ide_realize (piix.c:164)
==16447==    by 0x3EAEC6: pci_qdev_realize (pci.c:1790)
==16447==    by 0x36C685: device_set_realized (qdev.c:1058)
==16447==    by 0x47179E: property_set_bool (object.c:1514)
==16447==    by 0x470098: object_property_set (object.c:837)

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

Patch

diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 1b3d1c1..c5c4441 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -464,6 +464,7 @@  void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d)
     irq = qemu_allocate_irqs(bmdma_irq, bm, 1);
     bus->irq = *irq;
     bm->pci_dev = d;
+    g_free(irq);
 }
 
 static const TypeInfo pci_ide_type_info = {