mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user