mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh-nodedev: Avoid spurious errors
Our public free functions explicitly don't accept NULL pointers (sigh). Therefore, callers must do something like this: if (dev) virNodeDeviceFree(dev); And we are not doing that on two places I've found. This leads to dummy error message thrown by virsh: virsh # nodedev-dumpxml nonexistent-device error: Could not find matching device 'nonexistent-device' error: invalid node device pointer in virNodeDeviceFree Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
819ca36e2b
commit
289a3163de
@ -162,7 +162,8 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
|
||||
ret = true;
|
||||
cleanup:
|
||||
virStringFreeList(arr);
|
||||
virNodeDeviceFree(dev);
|
||||
if (dev)
|
||||
virNodeDeviceFree(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -571,7 +572,8 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
|
||||
cleanup:
|
||||
virStringFreeList(arr);
|
||||
VIR_FREE(xml);
|
||||
virNodeDeviceFree(device);
|
||||
if (device)
|
||||
virNodeDeviceFree(device);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user