提交 527da4ce 编写于 作者: M Marc Hartmayer 提交者: Ján Tomko

qemu: Use refcounting for priv->monConfig

Use refcounting for priv->monConfig instead of asymmetric freeing.
Signed-off-by: NMarc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 27a9ebf2
...@@ -17026,21 +17026,18 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn, ...@@ -17026,21 +17026,18 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn,
if (qemuProcessAttach(conn, driver, vm, pid, if (qemuProcessAttach(conn, driver, vm, pid,
pidfile, monConfig, monJSON) < 0) { pidfile, monConfig, monJSON) < 0) {
monConfig = NULL;
qemuDomainRemoveInactive(driver, vm); qemuDomainRemoveInactive(driver, vm);
qemuDomainObjEndJob(driver, vm); qemuDomainObjEndJob(driver, vm);
goto cleanup; goto cleanup;
} }
monConfig = NULL;
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
qemuDomainObjEndJob(driver, vm); qemuDomainObjEndJob(driver, vm);
cleanup: cleanup:
virDomainDefFree(def); virDomainDefFree(def);
virDomainChrSourceDefFree(monConfig); virObjectUnref(monConfig);
virDomainObjEndAPI(&vm); virDomainObjEndAPI(&vm);
VIR_FREE(pidfile); VIR_FREE(pidfile);
virObjectUnref(caps); virObjectUnref(caps);
......
...@@ -7528,8 +7528,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -7528,8 +7528,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
goto error; goto error;
VIR_DEBUG("Preparing monitor state"); VIR_DEBUG("Preparing monitor state");
priv->monConfig = monConfig; priv->monConfig = virObjectRef(monConfig);
monConfig = NULL;
priv->monJSON = monJSON; priv->monJSON = monJSON;
/* Attaching to running QEMU so we need to detect whether it was started /* Attaching to running QEMU so we need to detect whether it was started
...@@ -7648,7 +7647,8 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -7648,7 +7647,8 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_FREE(sec_managers); VIR_FREE(sec_managers);
if (seclabelgen) if (seclabelgen)
virSecurityLabelDefFree(seclabeldef); virSecurityLabelDefFree(seclabeldef);
virDomainChrSourceDefFree(monConfig); virObjectUnref(priv->monConfig);
priv->monConfig = NULL;
virObjectUnref(cfg); virObjectUnref(cfg);
virObjectUnref(caps); virObjectUnref(caps);
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册