diff options
author | 2011-08-23 21:42:22 +0800 | |
---|---|---|
committer | 2011-08-23 21:42:22 +0800 | |
commit | 241cbc13acfae4b107bb2903d52d01f86b3ef72a (patch) | |
tree | 0658ed6ce881975bdfcdbe56dd6f6239077d1e7f /tools | |
parent | xen: Cleanup improper VIR_ERR_NO_SUPPORT use (diff) | |
download | libvirt-241cbc13acfae4b107bb2903d52d01f86b3ef72a.tar.gz libvirt-241cbc13acfae4b107bb2903d52d01f86b3ef72a.tar.bz2 libvirt-241cbc13acfae4b107bb2903d52d01f86b3ef72a.zip |
virsh: Do not try to free domain if it is NULL
Without these patch, there will be error like below if domain
is NULL.
error: invalid domain pointer in virDomainFree
Which is useless.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virsh.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/virsh.c b/tools/virsh.c index 004fe80ff..0bb4c679d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5201,17 +5201,17 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd, int ret = -1; if (!vshConnectionUsability(ctl, ctl->conn)) - goto out; + goto cleanup; if (!(dom = vshCommandOptDomain(ctl, cmd, &name))) - goto out; + goto cleanup; if (vshCommandOptString(cmd, "path", &path) < 0) - goto out; + goto cleanup; if (vshCommandOptUL(cmd, "bandwidth", &bandwidth) < 0) { vshError(ctl, "%s", _("bandwidth must be a number")); - goto out; + goto cleanup; } if (mode == VSH_CMD_BLOCK_JOB_ABORT) @@ -5224,7 +5224,8 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd, ret = virDomainBlockPull(dom, path, bandwidth, 0); out: - virDomainFree(dom); + if (dom) + virDomainFree(dom); return ret; } |