The virDomainObjListRemove will return an unlocked
@vm after calling with a reffed object, thus prior
to calling virDomainObjEndAPI we should relock.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/lxc/lxc_driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 54f853cbae..9cf67b9854 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -493,6 +493,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
if (virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def) < 0) {
virDomainObjListRemove(driver->domains, vm);
+ virObjectLock(vm);
goto cleanup;
}
@@ -557,6 +558,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
vm->persistent = 0;
} else {
virDomainObjListRemove(driver->domains, vm);
+ virObjectLock(vm);
}
ret = 0;
@@ -1529,8 +1531,10 @@ lxcDomainDestroyFlags(virDomainPtr dom,
endjob:
virLXCDomainObjEndJob(driver, vm);
- if (!vm->persistent)
+ if (!vm->persistent) {
virDomainObjListRemove(driver->domains, vm);
+ virObjectLock(vm);
+ }
cleanup:
virDomainObjEndAPI(&vm);
--
2.13.6