提交 a10eb613 编写于 作者: P Peter Krempa

Revert "qemu: Don't repeat virDomainObjEndAPI in qemuDomainBlockPull"

This reverts commit 421c9550

qemuDomainBlockPullCommon calls virDomainObjEndAPI internally so the
original commit made us shed two references of @vm instead of one
getting us into a premature free of @vm.

This is not a straight revert as qemuDomainBlockPull was modified
meanwhile. I've also added a warning comment that @vm is consumed.

https://bugzilla.redhat.com/show_bug.cgi?id=1777230Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 c8579871
...@@ -18443,24 +18443,23 @@ qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth, ...@@ -18443,24 +18443,23 @@ qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
unsigned int flags) unsigned int flags)
{ {
virDomainObjPtr vm; virDomainObjPtr vm;
int ret = -1;
virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1); virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1);
if (!(vm = qemuDomainObjFromDomain(dom))) if (!(vm = qemuDomainObjFromDomain(dom)))
return -1; return -1;
if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) if (virDomainBlockPullEnsureACL(dom->conn, vm->def) < 0) {
goto cleanup; virDomainObjEndAPI(&vm);
return -1;
if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) }
goto cleanup;
ret = qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags); if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) {
virDomainObjEndAPI(&vm);
return -1;
}
cleanup: /* qemuDomainBlockPullCommon consumes the reference on @vm */
virDomainObjEndAPI(&vm); return qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags);
return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册