Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 516490f6cd..cdd833f896 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -87,7 +87,8 @@ bhyveAutostartDomain(virDomainObj *vm, void *opaque)
{
const struct bhyveAutostartData *data = opaque;
int ret = 0;
- virObjectLock(vm);
+ g_autoptr(virLockGuard) lock = virObjectLockGuard(vm);
+
if (vm->autostart && !virDomainObjIsActive(vm)) {
virResetLastError();
ret = virBhyveProcessStart(data->conn, vm,
@@ -98,7 +99,6 @@ bhyveAutostartDomain(virDomainObj *vm, void *opaque)
vm->def->name, virGetLastErrorMessage());
}
}
- virObjectUnlock(vm);
return ret;
}
--
2.31.1