mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
Fix leak of usbDevice struct when initializing cgroups
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>
This commit is contained in:
parent
202535601c
commit
3e86e8f327
@ -427,8 +427,11 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (usbDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup,
|
if (usbDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup,
|
||||||
cgroup) < 0)
|
cgroup) < 0) {
|
||||||
|
usbFreeDevice(usb);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
usbFreeDevice(usb);
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
|
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
|
||||||
switch (hostdev->source.caps.type) {
|
switch (hostdev->source.caps.type) {
|
||||||
|
@ -302,8 +302,11 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
|
if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
|
||||||
&data) < 0)
|
&data) < 0) {
|
||||||
|
usbFreeDevice(usb);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
usbFreeDevice(usb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user