Add a 'cleanup' label and use jumps as we do in other places.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 71503898e4..3ad1699eb1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18522,24 +18522,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;
}
--
2.21.0