[vlc-devel] commit: Fix candidate filename leak in lua playlist. (Antoine Cellerier )

git version control git at videolan.org
Wed Sep 30 15:42:31 CEST 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Wed Sep 30 15:38:53 2009 +0200| [80660f17fb85da53713d06252c4e8033b22596eb] | committer: Antoine Cellerier 

Fix candidate filename leak in lua playlist.

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

 modules/misc/lua/demux.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/misc/lua/demux.c b/modules/misc/lua/demux.c
index 0635ecf..ea0eb2b 100644
--- a/modules/misc/lua/demux.c
+++ b/modules/misc/lua/demux.c
@@ -141,7 +141,7 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename,
         msg_Warn( p_demux, "Error loading script %s: %s", psz_filename,
                   lua_tostring( L, lua_gettop( L ) ) );
         lua_pop( L, 1 );
-        return VLC_EGENERIC;
+        goto error;
     }
 
     lua_getglobal( L, "probe" );
@@ -151,6 +151,7 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename,
         msg_Warn( p_demux, "Error while runing script %s, "
                   "function probe() not found", psz_filename );
         lua_pop( L, 1 );
+        goto error;
         return VLC_EGENERIC;
     }
 
@@ -160,22 +161,24 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename,
                   "function probe(): %s", psz_filename,
                   lua_tostring( L, lua_gettop( L ) ) );
         lua_pop( L, 1 );
+        goto error;
         return VLC_EGENERIC;
     }
 
     if( lua_gettop( L ) )
     {
-        int i_ret = VLC_EGENERIC;
         if( lua_toboolean( L, 1 ) )
         {
             msg_Dbg( p_demux, "Lua playlist script %s's "
                      "probe() function was successful", psz_filename );
-            i_ret = VLC_SUCCESS;
+            lua_pop( L, 1 );
+            return VLC_SUCCESS;
         }
         lua_pop( L, 1 );
-
-        return i_ret;
     }
+
+error:
+    FREENULL( p_sys->psz_filename );
     return VLC_EGENERIC;
 }
 




More information about the vlc-devel mailing list