提交 289a3163 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
上级 819ca36e
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册