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

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

 



On 2013年01月31日 03:36, John Ferlan wrote:
---
  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;

Hum, since there are 3 patches do the similar changes. I have
to say we should avoid what Peter always tries to cleanup,
and change these patches like:


if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup,&data)<  0) {
    usbFreeDevice(usb);
    goto error;
}
usbFreeDevice(usb);

This applies to 9/11 and 10/11 too.

ACK with the changes.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]