[vlc-commits] modules: fix leak on error

Rémi Denis-Courmont git at videolan.org
Thu Apr 12 19:48:18 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr  8 18:48:38 2018 +0300| [15e4470b0b8655f8958fe70f697f462f6676f0b0] | committer: Rémi Denis-Courmont

modules: fix leak on error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15e4470b0b8655f8958fe70f697f462f6676f0b0
---

 src/modules/bank.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/modules/bank.c b/src/modules/bank.c
index c4f7546c7c..bc54192c48 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -517,8 +517,7 @@ int module_Map(vlc_object_t *obj, vlc_plugin_t *plugin)
     if (entry == NULL)
     {
         msg_Err(obj, "cannot find plug-in entry point in %s", plugin->abspath);
-        vlc_dlclose(handle);
-        return -1;
+        goto error;
     }
 
     vlc_mutex_lock(&lock);
@@ -527,7 +526,7 @@ int module_Map(vlc_object_t *obj, vlc_plugin_t *plugin)
         if (vlc_plugin_resolve(plugin, entry))
         {
             vlc_mutex_unlock(&lock);
-            return -1;
+            goto error;
         }
 
         atomic_store_explicit(&plugin->handle, (uintptr_t)handle,
@@ -538,6 +537,9 @@ int module_Map(vlc_object_t *obj, vlc_plugin_t *plugin)
     vlc_mutex_unlock(&lock);
 
     return 0;
+error:
+    vlc_dlclose(handle);
+    return -1;
 }
 
 /**



More information about the vlc-commits mailing list