Commit 588723d7 authored by Rémi Duraffort's avatar Rémi Duraffort

Add vlclua_dir_list_free to free list created by vlclua_dir_list and use it.

parent 07be8bb5
......@@ -143,6 +143,13 @@ int vlclua_dir_list( const char *luadirname, char **ppsz_dir_list )
return VLC_SUCCESS;
}
void vlclua_dir_list_free( char **ppsz_dir_list )
{
char **ppsz_dir;
for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
free( *ppsz_dir );
}
/*****************************************************************************
* Will execute func on all scripts in luadirname, and stop if func returns
* success.
......@@ -192,7 +199,10 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
char *psz_filename;
if( asprintf( &psz_filename,
"%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file ) < 0)
{
vlclua_dir_list_free( ppsz_dir_list );
return VLC_ENOMEM;
}
msg_Dbg( p_this, "Trying Lua playlist script %s", psz_filename );
i_ret = func( p_this, psz_filename, L, user_data );
......@@ -211,8 +221,7 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
free( *ppsz_file );
free( ppsz_filelist );
}
for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
free( *ppsz_dir );
vlclua_dir_list_free( ppsz_dir_list );
return i_ret;
}
......
......@@ -106,6 +106,7 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this, const char * luadirname,
int (*func)(vlc_object_t *, const char *, lua_State *, void *),
lua_State * L, void * user_data );
int vlclua_dir_list( const char *luadirname, char **ppsz_dir_list );
void vlclua_dir_list_free( char **ppsz_dir_list );
/*****************************************************************************
* Playlist and meta data internal utilities.
......
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