[vlc-commits] cache: missing error handling and leak on error

Rémi Denis-Courmont git at videolan.org
Sat Apr 25 08:48:23 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 25 09:48:06 2015 +0300| [4dc5e6b38417a1226303c1ef67acdab91906248f] | committer: Rémi Denis-Courmont

cache: missing error handling and leak on error

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

 src/modules/cache.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/modules/cache.c b/src/modules/cache.c
index f43fea9..b529a4a 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -217,6 +217,8 @@ error:
 static module_t *CacheLoadModule (FILE *file)
 {
     module_t *module = vlc_module_create (NULL);
+    if (unlikely(module == NULL))
+        return NULL;
 
     /* Load additional infos */
     LOAD_STRING(module->psz_shortname);
@@ -274,7 +276,8 @@ static module_t *CacheLoadModule (FILE *file)
 
     return module;
 error:
-    return NULL; /* FIXME: leaks */
+    vlc_module_destroy(module);
+    return NULL;
 }
 
 /**



More information about the vlc-commits mailing list