[vlc-devel] commit: Fix memleaks (use vlclua_dir_list_free). ( Rémi Duraffort )

git version control git at videolan.org
Fri Aug 1 20:03:54 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Aug  1 20:01:54 2008 +0200| [22dbf2bfad420b171fee86c1a97a433929e6fc1e] | committer: Rémi Duraffort 

Fix memleaks (use vlclua_dir_list_free).

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

 modules/misc/lua/intf.c      |    3 +++
 modules/misc/lua/libs/misc.c |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index 76bbcdf..f86acdf 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -73,16 +73,19 @@ static char *FindFile( const char *psz_name )
         if( asprintf( &psz_filename, "%s"DIR_SEP"%s.lua", *ppsz_dir,
                       psz_name ) < 0 )
         {
+            vlclua_dir_list_free( ppsz_dir_list );
             return NULL;
         }
         fp = fopen( psz_filename, "r" );
         if( fp )
         {
             fclose( fp );
+            vlclua_dir_list_free( ppsz_dir_list );
             return psz_filename;
         }
         free( psz_filename );
     }
+    vlclua_dir_list_free( ppsz_dir_list );
     return NULL;
 }
 
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index 549839b..6efec4a 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -162,6 +162,7 @@ static int vlclua_datadir_list( lua_State *L )
         lua_rawseti( L, -2, i );
         i ++;
     }
+    vlclua_dir_list_free( ppsz_dir_list );
     return 1;
 }
 /*****************************************************************************




More information about the vlc-devel mailing list