vlc | branch: master | Rémi Denis-Courmont <r...@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;
 }
 
 /**

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to