1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +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:
Michal Privoznik 2014-06-02 16:48:22 +02:00
parent 819ca36e2b
commit 289a3163de

View File

@ -162,6 +162,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
virStringFreeList(arr);
if (dev)
virNodeDeviceFree(dev);
return ret;
}
@ -571,6 +572,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
cleanup:
virStringFreeList(arr);
VIR_FREE(xml);
if (device)
virNodeDeviceFree(device);
return ret;
}