[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 11/11] qemu_hotplug: Need to call usbFreeDevice()



---
 src/qemu/qemu_hotplug.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 18c4109..2a52650 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1,7 +1,7 @@
 /*
  * qemu_hotplug.h: QEMU device hotplug management
  *
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -1120,6 +1120,7 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
         virCgroupPtr cgroup = NULL;
         usbDevice *usb;
         qemuCgroupData data;
+        int rc;
 
         if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1135,7 +1136,9 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
 
         data.vm = vm;
         data.cgroup = cgroup;
-        if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, &data) < 0)
+        rc = usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, &data);
+        usbFreeDevice(usb);
+        if (rc < 0)
             goto error;
     }
 
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]