On 9/27/19 3:05 PM, Peter Krempa wrote:
Use VIR_AUTORELEASE instead.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0988071708..ed59e64c10 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18911,21 +18911,19 @@ static int
qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
unsigned int flags)
{
- virDomainObjPtr vm;
+ VIR_AUTORELEASE(virDomainObjPtr) vm = NULL;
+
virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1);
if (!(vm = qemuDomObjFromDomain(dom)))
return -1;
- if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) {
- virDomainObjEndAPI(&vm);
+ if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0)
return -1;
- }
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;
}
This needs to be rebased. But also, you've missed one virDomainObjEndAPI() at the end.
This patch needs to look like this:
diff --git c/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 103187709b..1bcb99f13d 100644
--- c/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -18497,25 +18497,23 @@ static int
qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
unsigned int flags)
{
- virDomainObjPtr vm;
- int ret = -1;
+ VIR_AUTORELEASE(virDomainObjPtr) vm = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1);
if (!(vm = qemuDomainObjFromDomain(dom)))
return -1;
if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
+ return -1;
if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
- goto cleanup;
+ return -1;
- ret = qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags);
+ if (qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags) < 0)
+ return -1;
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
+ return 0;
}
Michal