提交 0c500a4f 编写于 作者: H Hongwei Bi 提交者: Peter Krempa

virsh-volume: Add missing check when calling virStreamNew

Check return value of virStreamNew when called by cmdVolUpload and
cmdVolDownload.
上级 7db19ff9
......@@ -665,7 +665,11 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
st = virStreamNew(ctl->conn, 0);
if (!(st = virStreamNew(ctl->conn, 0))) {
vshError(ctl, _("cannot create a new stream"));
goto cleanup;
}
if (virStorageVolUpload(vol, st, offset, length, 0) < 0) {
vshError(ctl, _("cannot upload to volume %s"), name);
goto cleanup;
......@@ -775,7 +779,11 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd)
created = true;
}
st = virStreamNew(ctl->conn, 0);
if (!(st = virStreamNew(ctl->conn, 0))) {
vshError(ctl, _("cannot create a new stream"));
goto cleanup;
}
if (virStorageVolDownload(vol, st, offset, length, 0) < 0) {
vshError(ctl, _("cannot download from volume %s"), name);
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册