提交 3e86e8f3 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 20253560
...@@ -427,8 +427,11 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, ...@@ -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, ...@@ -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);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册