[libvirt] [PATCH] Error path mutex unlock in virGetStorageVol.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
---
 src/datatypes.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/datatypes.c b/src/datatypes.c
index 1889dc3..ac61682 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -863,19 +863,16 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
     ret = (virStorageVolPtr) virHashLookup(conn->storageVols, key);
     if (ret == NULL) {
         if (VIR_ALLOC(ret) < 0) {
-            virMutexUnlock(&conn->lock);
             virReportOOMError(conn);
             goto error;
         }
         ret->pool = strdup(pool);
         if (ret->pool == NULL) {
-            virMutexUnlock(&conn->lock);
             virReportOOMError(conn);
             goto error;
         }
         ret->name = strdup(name);
         if (ret->name == NULL) {
-            virMutexUnlock(&conn->lock);
             virReportOOMError(conn);
             goto error;
         }
@@ -885,7 +882,6 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
         ret->conn = conn;
 
         if (virHashAddEntry(conn->storageVols, key, ret) < 0) {
-            virMutexUnlock(&conn->lock);
             virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
                             "%s", _("failed to add storage vol to connection hash table"));
             goto error;
@@ -897,6 +893,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
     return(ret);
 
 error:
+    virMutexUnlock(&conn->lock);
     if (ret != NULL) {
         VIR_FREE(ret->name);
         VIR_FREE(ret->pool);
-- 
1.6.0.6

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]