Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 src/network/bridge_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e8b9ffa1fc..5ccc3817d4 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3143,7 +3143,7 @@ static int
 networkBridgeNameValidate(virNetworkObjList *nets,
                           virNetworkDef *def)
 {
-    virMutexLock(&bridgeNameValidateMutex);
+    vir_g_autoptr(virLockGuard) lock = 
virLockGuardNew(&bridgeNameValidateMutex);
 
     if (def->bridge && !strstr(def->bridge, "%d")) {
         if (virNetworkObjBridgeInUse(nets, def->bridge, def->name)) {
@@ -3158,11 +3158,9 @@ networkBridgeNameValidate(virNetworkObjList *nets,
             goto error;
     }
 
-    virMutexUnlock(&bridgeNameValidateMutex);
     return 0;
 
  error:
-    virMutexUnlock(&bridgeNameValidateMutex);
     return -1;
 }
 
-- 
2.31.1

Reply via email to