When iterating over USB host devices to setup cgroups, the
usbDevice object was leaked in both LXC and QEMU driers
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
goto cleanup;
if (usbDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup,
- cgroup) < 0)
+ cgroup) < 0) {
+ usbFreeDevice(usb);
goto cleanup;
+ }
+ usbFreeDevice(usb);
break;
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
switch (hostdev->source.caps.type) {
goto cleanup;
if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
- &data) < 0)
+ &data) < 0) {
+ usbFreeDevice(usb);
goto cleanup;
+ }
+ usbFreeDevice(usb);
}
}