Re: [PATCH 1/4] qemu: Don't free PCI device if adding it to activePciHostdevs fails

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

 



On 2012年12月04日 18:38, Jiri Denemark wrote:
The device is still referenced from pcidevs and freeing it would leave
an invalid pointer there.
---
  src/qemu/qemu_hostdev.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index ab0f173..b79319e 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -491,10 +491,8 @@ int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
      /* Loop 5: Now mark all the devices as active */
      for (i = 0; i<  pciDeviceListCount(pcidevs); i++) {
          pciDevice *dev = pciDeviceListGet(pcidevs, i);
-        if (pciDeviceListAdd(driver->activePciHostdevs, dev)<  0) {
-            pciFreeDevice(dev);
+        if (pciDeviceListAdd(driver->activePciHostdevs, dev)<  0)
              goto inactivedevs;
-        }
      }

      /* Loop 6: Now remove the devices from inactive list. */

ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]