Commit 22dbf2bf authored by Rémi Duraffort's avatar Rémi Duraffort

Fix memleaks (use vlclua_dir_list_free).

parent 588723d7
...@@ -73,16 +73,19 @@ static char *FindFile( const char *psz_name ) ...@@ -73,16 +73,19 @@ static char *FindFile( const char *psz_name )
if( asprintf( &psz_filename, "%s"DIR_SEP"%s.lua", *ppsz_dir, if( asprintf( &psz_filename, "%s"DIR_SEP"%s.lua", *ppsz_dir,
psz_name ) < 0 ) psz_name ) < 0 )
{ {
vlclua_dir_list_free( ppsz_dir_list );
return NULL; return NULL;
} }
fp = fopen( psz_filename, "r" ); fp = fopen( psz_filename, "r" );
if( fp ) if( fp )
{ {
fclose( fp ); fclose( fp );
vlclua_dir_list_free( ppsz_dir_list );
return psz_filename; return psz_filename;
} }
free( psz_filename ); free( psz_filename );
} }
vlclua_dir_list_free( ppsz_dir_list );
return NULL; return NULL;
} }
......
...@@ -162,6 +162,7 @@ static int vlclua_datadir_list( lua_State *L ) ...@@ -162,6 +162,7 @@ static int vlclua_datadir_list( lua_State *L )
lua_rawseti( L, -2, i ); lua_rawseti( L, -2, i );
i ++; i ++;
} }
vlclua_dir_list_free( ppsz_dir_list );
return 1; return 1;
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment