mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 14:05:19 +00:00
qemu: Don't leak temporary list of USB devices
and add debug message when adding USB device
to the list of active devices.
(cherry picked from commit b2c7b9ee0e
)
This commit is contained in:
parent
cde4c634e7
commit
779ac7ab69
@ -559,10 +559,7 @@ qemuPrepareHostdevUSBDevices(struct qemud_driver *driver,
|
|||||||
hostdev->source.subsys.u.usb.product);
|
hostdev->source.subsys.u.usb.product);
|
||||||
|
|
||||||
if (!usb)
|
if (!usb)
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
hostdev->source.subsys.u.usb.bus = usbDeviceGetBus(usb);
|
|
||||||
hostdev->source.subsys.u.usb.device = usbDeviceGetDevno(usb);
|
|
||||||
|
|
||||||
if ((tmp = usbDeviceListFind(driver->activeUsbHostdevs, usb))) {
|
if ((tmp = usbDeviceListFind(driver->activeUsbHostdevs, usb))) {
|
||||||
const char *other_name = usbDeviceGetUsedBy(tmp);
|
const char *other_name = usbDeviceGetUsedBy(tmp);
|
||||||
@ -579,6 +576,9 @@ qemuPrepareHostdevUSBDevices(struct qemud_driver *driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hostdev->source.subsys.u.usb.bus = usbDeviceGetBus(usb);
|
||||||
|
hostdev->source.subsys.u.usb.device = usbDeviceGetDevno(usb);
|
||||||
|
|
||||||
if (usbDeviceListAdd(list, usb) < 0) {
|
if (usbDeviceListAdd(list, usb) < 0) {
|
||||||
usbFreeDevice(usb);
|
usbFreeDevice(usb);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -594,6 +594,9 @@ qemuPrepareHostdevUSBDevices(struct qemud_driver *driver,
|
|||||||
for (i = 0; i < usbDeviceListCount(list); i++) {
|
for (i = 0; i < usbDeviceListCount(list); i++) {
|
||||||
tmp = usbDeviceListGet(list, i);
|
tmp = usbDeviceListGet(list, i);
|
||||||
usbDeviceSetUsedBy(tmp, name);
|
usbDeviceSetUsedBy(tmp, name);
|
||||||
|
|
||||||
|
VIR_DEBUG("Adding %03d.%03d dom=%s to activeUsbHostdevs",
|
||||||
|
usbDeviceGetBus(tmp), usbDeviceGetDevno(tmp), name);
|
||||||
if (usbDeviceListAdd(driver->activeUsbHostdevs, tmp) < 0) {
|
if (usbDeviceListAdd(driver->activeUsbHostdevs, tmp) < 0) {
|
||||||
usbFreeDevice(tmp);
|
usbFreeDevice(tmp);
|
||||||
goto inactivedevs;
|
goto inactivedevs;
|
||||||
|
Loading…
Reference in New Issue
Block a user