]> xenbits.xensource.com Git - qemu-xen-4.6-testing.git/commitdiff
ide: don't leak irq array in pci_cmd646_ide_init()
authorYunlei Ding <yunlei.ding@citrix.com>
Fri, 18 Apr 2014 05:11:30 +0000 (06:11 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Oct 2015 15:52:07 +0000 (16:52 +0100)
Call qemu_allocate_irq() twice instead of qemu_allocate_irqs to
allocate memory.

Signed-off-by: Yunlei Ding <yunlei.ding@citrix.com>
(defects not identified by Coverity Scan)
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
hw/ide.c

index 4c30edd2748e2c3c733fbbf358dffc28c1e4d34c..e4ad3609f25b30a5378bc9a3bee3ed72da59a80f 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -3676,7 +3676,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),
@@ -3718,9 +3717,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);