提交 abd1e54f 编写于 作者: J John Ferlan

lxc: Fix possible leaked @vm in lxcDomainCreateXMLWithFiles

In error paths, if we call virDomainObjListRemove we will leak
the @vm because we have called with a reffed and locked @vm.
So rather than set it to NULL, relock the @vm and allow the
virDomainObjEndAPI to perform the magic of Unlock/Unref.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 f52d0d42
...@@ -1245,7 +1245,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, ...@@ -1245,7 +1245,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) { if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) {
if (!vm->persistent) { if (!vm->persistent) {
virDomainObjListRemove(driver->domains, vm); virDomainObjListRemove(driver->domains, vm);
vm = NULL; virObjectLock(vm);
} }
goto cleanup; goto cleanup;
} }
...@@ -1258,7 +1258,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, ...@@ -1258,7 +1258,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
virLXCDomainObjEndJob(driver, vm); virLXCDomainObjEndJob(driver, vm);
if (!vm->persistent) { if (!vm->persistent) {
virDomainObjListRemove(driver->domains, vm); virDomainObjListRemove(driver->domains, vm);
vm = NULL; virObjectLock(vm);
} }
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册