mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +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;
|
||||
|
||||
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) {
|
||||
|
@ -302,8 +302,11 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
|
||||
if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,
|
||||
&data) < 0)
|
||||
&data) < 0) {
|
||||
usbFreeDevice(usb);
|
||||
goto cleanup;
|
||||
}
|
||||
usbFreeDevice(usb);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user