qemu: Don't repeat virDomainObjEndAPI in qemuDomainBlockPull

Add a 'cleanup' label and use jumps as we do in other places.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2019-09-26 13:50:16 +02:00
parent e5cf665b09
commit 421c9550f5
1 changed files with 10 additions and 7 deletions

View File

@ -18512,24 +18512,27 @@ qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
unsigned int flags)
{
virDomainObjPtr vm;
int ret = -1;
virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1);
if (!(vm = qemuDomainObjFromDomain(dom)))
return -1;
if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) {
virDomainObjEndAPI(&vm);
return -1;
}
if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot perform block pull while checkpoint exists"));
virDomainObjEndAPI(&vm);
return -1;
goto cleanup;
}
return qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags);
ret = qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags);
cleanup:
virDomainObjEndAPI(&vm);
return ret;
}