提交 ea1a9b5f 编写于 作者: J Jiri Denemark

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.
上级 935550c6
......@@ -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. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册