提交 fef8d1a0 编写于 作者: J John Ferlan 提交者: Eric Blake

util: Check for NULL 'dev' on input to usbFreeDevice

Added 'usbFreeDevice' to the useless_free_options list in cfg.mk
上级 0a5eaf0d
......@@ -98,6 +98,7 @@ useless_free_options = \
--name=qemuMigrationCookieFree \
--name=qemuMigrationCookieGraphicsFree \
--name=sexpr_free \
--name=usbFreeDevice \
--name=virBandwidthDefFree \
--name=virBitmapFree \
--name=virCPUDefFree \
......
......@@ -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 *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册