mirror of https://gitee.com/openkylin/libvirt.git
util: Check for NULL 'dev' on input to usbFreeDevice
Added 'usbFreeDevice' to the useless_free_options list in cfg.mk
This commit is contained in:
parent
0a5eaf0d59
commit
fef8d1a010
1
cfg.mk
1
cfg.mk
|
@ -98,6 +98,7 @@ useless_free_options = \
|
||||||
--name=qemuMigrationCookieFree \
|
--name=qemuMigrationCookieFree \
|
||||||
--name=qemuMigrationCookieGraphicsFree \
|
--name=qemuMigrationCookieGraphicsFree \
|
||||||
--name=sexpr_free \
|
--name=sexpr_free \
|
||||||
|
--name=usbFreeDevice \
|
||||||
--name=virBandwidthDefFree \
|
--name=virBandwidthDefFree \
|
||||||
--name=virBitmapFree \
|
--name=virBitmapFree \
|
||||||
--name=virCPUDefFree \
|
--name=virCPUDefFree \
|
||||||
|
|
|
@ -356,6 +356,8 @@ usbGetDevice(unsigned int bus,
|
||||||
void
|
void
|
||||||
usbFreeDevice(usbDevice *dev)
|
usbFreeDevice(usbDevice *dev)
|
||||||
{
|
{
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
VIR_DEBUG("%s %s: freeing", dev->id, dev->name);
|
VIR_DEBUG("%s %s: freeing", dev->id, dev->name);
|
||||||
VIR_FREE(dev->path);
|
VIR_FREE(dev->path);
|
||||||
VIR_FREE(dev);
|
VIR_FREE(dev);
|
||||||
|
@ -496,8 +498,7 @@ usbDeviceListDel(usbDeviceList *list,
|
||||||
usbDevice *dev)
|
usbDevice *dev)
|
||||||
{
|
{
|
||||||
usbDevice *ret = usbDeviceListSteal(list, dev);
|
usbDevice *ret = usbDeviceListSteal(list, dev);
|
||||||
if (ret)
|
usbFreeDevice(ret);
|
||||||
usbFreeDevice(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usbDevice *
|
usbDevice *
|
||||||
|
|
Loading…
Reference in New Issue