mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: hotplug: Fix double free on USB collision
If we hit a collision, we free the USB device while it is still part of our temporary USBDeviceList. When the list is unref'd, the device is free'd again. Make the initial device freeing dependent on whether it is present in the temporary list or not.
This commit is contained in:
parent
ee414b5d6d
commit
5953a73787
@ -1518,7 +1518,10 @@ cleanup:
|
||||
}
|
||||
if (added)
|
||||
virUSBDeviceListSteal(driver->activeUsbHostdevs, usb);
|
||||
virUSBDeviceFree(usb);
|
||||
if (list && usb &&
|
||||
!virUSBDeviceListFind(list, usb) &&
|
||||
!virUSBDeviceListFind(driver->activeUsbHostdevs, usb))
|
||||
virUSBDeviceFree(usb);
|
||||
virObjectUnref(list);
|
||||
VIR_FREE(devstr);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user