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

[Xen-devel] [PATCH 29/32] ide: don't leak irq array in pci_cmd646_ide_init()



From: Yunlei Ding <yunlei.ding@xxxxxxxxxx>

Call qemu_allocate_irq() twice instead of qemu_allocate_irqs to
allocate memory.

Signed-off-by: Yunlei Ding <yunlei.ding@xxxxxxxxxx>
(defects not identified by Coverity Scan)
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 hw/ide.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/ide.c b/hw/ide.c
index f372b7b..e7b9f24 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -3652,7 +3652,6 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState 
**hd_table,
     PCIIDEState *d;
     uint8_t *pci_conf;
     int i;
-    qemu_irq *irq;
 
     d = (PCIIDEState *)pci_register_device(bus, "CMD646 IDE",
                                            sizeof(PCIIDEState),
@@ -3694,9 +3693,8 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState 
**hd_table,
     for(i = 0; i < 4; i++)
         d->ide_if[i].pci_dev = (PCIDevice *)d;
 
-    irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
-    ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], irq[0]);
-    ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], irq[1]);
+    ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], 
qemu_allocate_irq(cmd646_set_irq, d));
+    ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], 
qemu_allocate_irq(cmd646_set_irq, d));
 
     register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d);
     qemu_register_reset(cmd646_reset, d);
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.