virsh-domain: Add a missing check and fix leak in cmdScreenshot

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Hongwei Bi 2013-09-25 22:54:24 +08:00 committed by Eric Blake
parent 0377238fe8
commit b80fff1444

View File

@ -4610,7 +4610,8 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
st = virStreamNew(ctl->conn, 0);
if (!(st = virStreamNew(ctl->conn, 0)))
goto cleanup;
mime = virDomainScreenshot(dom, st, screen, flags);
if (!mime) {
@ -4619,8 +4620,8 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
}
if (!file) {
if (!(file=vshGenFileName(ctl, dom, mime)))
return false;
if (!(file = vshGenFileName(ctl, dom, mime)))
goto cleanup;
generated = true;
}