Added 'usbFreeDevice' to the useless_free_options list in cfg.mk --- cfg.mk | 1 + src/util/virusb.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cfg.mk b/cfg.mk index f9270b0..ab163af 100644 --- a/cfg.mk +++ b/cfg.mk @@ -98,6 +98,7 @@ useless_free_options = \ --name=qemuMigrationCookieFree \ --name=qemuMigrationCookieGraphicsFree \ --name=sexpr_free \ + --name=usbFreeDevice \ --name=virBandwidthDefFree \ --name=virBitmapFree \ --name=virCPUDefFree \ diff --git a/src/util/virusb.c b/src/util/virusb.c index c09f6da..1ec5f45 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -356,6 +356,8 @@ usbGetDevice(unsigned int bus, void usbFreeDevice(usbDevice *dev) { + if (!dev) + return; VIR_DEBUG("%s %s: freeing", dev->id, dev->name); VIR_FREE(dev->path); VIR_FREE(dev); @@ -496,8 +498,7 @@ usbDeviceListDel(usbDeviceList *list, usbDevice *dev) { usbDevice *ret = usbDeviceListSteal(list, dev); - if (ret) - usbFreeDevice(ret); + usbFreeDevice(ret); } usbDevice * -- 1.7.11.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list