1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

usb: fix crash when failing to attach a second usb device

when failing to attach another usb device to a domain for some reason
which has one use device attached before, the libvirtd crashed.
The crash is caused by null-pointer dereference error in invoking
usbDeviceListSteal passed in NULL value usb variable.
commit 05abd1507d66aabb6cad12eeafeb4c4d1911c585 introduces the bug.
This commit is contained in:
Guannan Ren 2012-05-11 14:29:15 +08:00
parent 38bd605b71
commit ab5fb8f34c

View File

@ -1213,7 +1213,8 @@ error:
cleanup:
usbDeviceListFree(list);
usbDeviceListSteal(driver->activeUsbHostdevs, usb);
if (usb)
usbDeviceListSteal(driver->activeUsbHostdevs, usb);
return -1;
}