Check return value of virStreamNew when called by
cmdVolUpload and cmdVolDownload.
---
tools/virsh-volume.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 7dab532..0a66a6c 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -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;
--
1.7.1
Show replies by date
On 09/29/13 11:24, Hongwei Bi wrote:
Check return value of virStreamNew when called by
cmdVolUpload and cmdVolDownload.
---
tools/virsh-volume.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
ACK && will be pushed soon.
Peter
2013/9/30 Peter Krempa <pkrempa(a)redhat.com>:
On 09/29/13 11:24, Hongwei Bi wrote:
> Check return value of virStreamNew when called by
> cmdVolUpload and cmdVolDownload.
>
>
> ---
> tools/virsh-volume.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
ACK && will be pushed soon.
Peter
Pushed; Thanks.