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;
}
return false;
}
-static const char *GetModuleName( intf_thread_t *p_intf )
+static char *GetModuleName( intf_thread_t *p_intf )
{
int i;
const char *psz_intf;
for( i = 0; pp_shortcuts[i].psz_name; i++ )
{
if( WordInList( psz_intf, pp_shortcuts[i].psz_shortcut ) )
- return pp_shortcuts[i].psz_name;
+ return strdup( pp_shortcuts[i].psz_name );
}
return config_GetPsz( p_intf, "lua-intf" );
intf_sys_t *p_sys;
lua_State *L;
- const char *psz_name = GetModuleName( p_intf );
+ char *psz_name = GetModuleName( p_intf );
const char *psz_config;
bool b_config_set = false;
- if( !psz_name ) psz_name = "dummy";
+ if( !psz_name ) psz_name = strdup( "dummy" );
p_intf->p_sys = (intf_sys_t*)malloc( sizeof(intf_sys_t*) );
if( !p_intf->p_sys )
{
+ free( psz_name );
return VLC_ENOMEM;
}
p_sys = p_intf->p_sys;
{
msg_Err( p_intf, "Couldn't find lua interface script \"%s\".",
psz_name );
+ free( psz_name );
+ free( p_sys );
return VLC_EGENERIC;
}
msg_Dbg( p_intf, "Found lua interface script: %s", p_sys->psz_filename );
if( !L )
{
msg_Err( p_intf, "Could not create new Lua State" );
+ free( psz_name );
free( p_sys );
return VLC_EGENERIC;
}
p_intf->pf_run = Run;
p_intf->psz_header = strdup( psz_name ); /* Do I need to clean that up myself in Close_LuaIntf? */
+ free( psz_name );
return VLC_SUCCESS;
}