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

[libvirt] [PATCH 7/7] Coverity: Fix resource leak in virnetlink.c



---
 src/util/virnetlink.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index b2e9d51..33db8db 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -337,11 +337,13 @@ virNetlinkEventServiceStart(void)
 
     if (VIR_ALLOC(srv) < 0) {
         virReportOOMError();
-        goto error;
+        return -1;
     }
 
-    if (virMutexInit(&srv->lock) < 0)
-        goto error;
+    if (virMutexInit(&srv->lock) < 0) {
+        VIR_FREE(srv);
+        return -1;
+    }
 
     virNetlinkEventServerLock(srv);
 
@@ -400,7 +402,6 @@ error_locked:
         virMutexDestroy(&srv->lock);
         VIR_FREE(srv);
     }
-error:
     return ret;
 }
 
-- 
1.7.7.3


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