diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 896ad9be67..ba6dadd4e7 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -511,7 +511,8 @@ int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, dev = pciDeviceListGet(pcidevs, i); activeDev = pciDeviceListFind(driver->activePciHostdevs, dev); - pciDeviceSetUsedBy(activeDev, name); + if (activeDev) + pciDeviceSetUsedBy(activeDev, name); } /* Loop 8: Now set the original states for hostdev def */