[libvirt] [PATCH 4/6] lxc: Check for non NULL usb prior to calling usbFreeDevice()

John Ferlan jferlan at redhat.com
Mon Jan 7 17:09:32 UTC 2013


---
 src/lxc/lxc_driver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 8050ce6..d4b4989 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3468,7 +3468,8 @@ cleanup:
     if (ret < 0 && created)
         unlink(dstfile);
 
-    usbFreeDevice(usb);
+    if (usb)
+        usbFreeDevice(usb);
     virCgroupFree(&group);
     VIR_FREE(src);
     VIR_FREE(dstfile);
@@ -4022,7 +4023,8 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
     ret = 0;
 
 cleanup:
-    usbFreeDevice(usb);
+    if (usb)
+        usbFreeDevice(usb);
     VIR_FREE(dst);
     virCgroupFree(&group);
     return ret;
-- 
1.7.11.7




More information about the libvir-list mailing list