mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-30 17:45:23 +00:00
qemu: Don't free PCI device if adding it to activePciHostdevs fails
The device is still referenced from pcidevs and freeing it would leave
an invalid pointer there.
(cherry picked from commit ea1a9b5fdd
)
This commit is contained in:
parent
6187407154
commit
9034c9286e
@ -491,10 +491,8 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
|
|||||||
/* Loop 5: Now mark all the devices as active */
|
/* Loop 5: Now mark all the devices as active */
|
||||||
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
||||||
pciDevice *dev = pciDeviceListGet(pcidevs, i);
|
pciDevice *dev = pciDeviceListGet(pcidevs, i);
|
||||||
if (pciDeviceListAdd(driver->activePciHostdevs, dev) < 0) {
|
if (pciDeviceListAdd(driver->activePciHostdevs, dev) < 0)
|
||||||
pciFreeDevice(dev);
|
|
||||||
goto inactivedevs;
|
goto inactivedevs;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop 6: Now remove the devices from inactive list. */
|
/* Loop 6: Now remove the devices from inactive list. */
|
||||||
|
Loading…
Reference in New Issue
Block a user