提交 48918587 编写于 作者: C Cole Robinson

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.

(cherry picked from commit 5953a737)
上级 8a4762ec
......@@ -1501,7 +1501,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册