Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 src/conf/virchrdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
index 8ca1c1062c..a95b8976ac 100644
--- a/src/conf/virchrdev.c
+++ b/src/conf/virchrdev.c
@@ -291,10 +291,10 @@ void virChrdevFree(virChrdevs *devs)
     if (!devs)
         return;
 
-    virMutexLock(&devs->lock);
-    virHashForEachSafe(devs->hash, virChrdevFreeClearCallbacks, NULL);
-    virHashFree(devs->hash);
-    virMutexUnlock(&devs->lock);
+    WITH_VIR_MUTEX_LOCK_GUARD(&devs->lock) {
+        virHashForEachSafe(devs->hash, virChrdevFreeClearCallbacks, NULL);
+        virHashFree(devs->hash);
+    }
     virMutexDestroy(&devs->lock);
 
     g_free(devs);
-- 
2.31.1

Reply via email to