Without these patch, there will be error like below if domain is NULL. error: invalid domain pointer in virDomainFree Which is useless. --- tools/virsh.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 7d849ec..5f7bbcb 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5201,16 +5201,16 @@ 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) - goto out; + goto cleanup; if (mode == VSH_CMD_BLOCK_JOB_ABORT) ret = virDomainBlockJobAbort(dom, path, 0); @@ -5221,8 +5221,8 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd, else if (mode == VSH_CMD_BLOCK_JOB_PULL) ret = virDomainBlockPull(dom, path, bandwidth, 0); -out: - virDomainFree(dom); +cleanup: + if (dom) virDomainFree(dom); return ret; } -- 1.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list