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: John Ferlan <jferlan@redhat.com>
if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) {
if (!vm->persistent) {
virDomainObjListRemove(driver->domains, vm);
- vm = NULL;
+ virObjectLock(vm);
}
goto cleanup;
}
virLXCDomainObjEndJob(driver, vm);
if (!vm->persistent) {
virDomainObjListRemove(driver->domains, vm);
- vm = NULL;
+ virObjectLock(vm);
}
goto cleanup;
}