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

[libvirt] [PATCH 05/10] lock: avoid leak on failure



Detected by Coverity.  Only possible on OOM situations.

* src/locking/lock_manager.c (virLockManagerPluginNew): Plug leak.
---
 src/locking/lock_manager.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 6197fd4..138cc91 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -120,7 +120,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
 {
     void *handle = NULL;
     virLockDriverPtr driver;
-    virLockManagerPluginPtr plugin;
+    virLockManagerPluginPtr plugin = NULL;
     const char *moddir = getenv("LIBVIRT_LOCK_MANAGER_PLUGIN_DIR");
     char *modfile = NULL;

@@ -182,6 +182,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
     return plugin;

 cleanup:
+    VIR_FREE(plugin);
     VIR_FREE(modfile);
     if (handle)
         dlclose(handle);
-- 
1.7.4.4


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