提交 fa8a389e 编写于 作者: R Roman Bogorodskiy

bhyve: bhyveDomainDefineXML fixes

- do not lose new definition for an active domain
- do not leak oldDef
- do not set dom->id if virDomainSaveConfig() fails
- do not call virObjectUnlock(vm) if vm is NULL
上级 7b6b9d38
......@@ -472,17 +472,23 @@ bhyveDomainDefineXML(virConnectPtr conn, const char *xml)
def = NULL;
vm->persistent = 1;
if (virDomainSaveConfig(BHYVE_CONFIG_DIR,
vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(privconn->domains, vm);
vm = NULL;
goto cleanup;
}
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom)
dom->id = vm->def->id;
if (virDomainSaveConfig(BHYVE_CONFIG_DIR, vm->def) < 0)
goto cleanup;
cleanup:
virObjectUnref(caps);
virDomainDefFree(def);
virObjectUnlock(vm);
virDomainDefFree(oldDef);
if (vm)
virObjectUnlock(vm);
return dom;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册