[vlc-devel] commit: lua_intf: fix memleaks. ( Rémi Duraffort )

git version control git at videolan.org
Thu Nov 12 15:46:41 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Nov 12 15:35:28 2009 +0100| [8d926ee8a6fb15cfb733d9225c411b96702762bf] | committer: Rémi Duraffort 

lua_intf: fix memleaks.

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

 modules/misc/lua/intf.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index 2207cc7..f9f0dce 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -177,6 +177,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
     if( !L )
     {
         msg_Err( p_intf, "Could not create new Lua State" );
+        free( p_sys->psz_filename );
         free( psz_name );
         free( p_sys );
         return VLC_EGENERIC;
@@ -225,6 +226,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
                   "package.path = \"%s"DIR_SEP"modules"DIR_SEP"?.lua;\"..package.path",
                   p_sys->psz_filename ) < 0 )
     {
+        free( p_sys->psz_filename );
         free( psz_name );
         free( p_sys );
         return VLC_EGENERIC;
@@ -232,10 +234,13 @@ int Open_LuaIntf( vlc_object_t *p_this )
     *psz_char = DIR_SEP_CHAR;
     if( luaL_dostring( L, psz_command ) )
     {
+        free( psz_command );
+        free( p_sys->psz_filename );
         free( psz_name );
         free( p_sys );
         return VLC_EGENERIC;
     }
+    free( psz_command );
     }
     /* </gruik> */
 
@@ -305,6 +310,8 @@ void Close_LuaIntf( vlc_object_t *p_this )
     vlc_mutex_destroy( &p_sys->lock );
 
     lua_close( p_sys->L );
+
+    free( p_sys->psz_filename );
     free( p_sys );
 }
 




More information about the vlc-devel mailing list