Commit 9a034400 authored by Pierre Ynard's avatar Pierre Ynard

luasd: remove useless strdup()

parent 3efc8f32
...@@ -678,7 +678,7 @@ static int vlc_sd_probe_Open( vlc_object_t *obj ) ...@@ -678,7 +678,7 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
lua_close( L ); lua_close( L );
continue; continue;
} }
char *psz_longname; const char *psz_longname;
char *temp = strchr( *ppsz_file, '.' ); char *temp = strchr( *ppsz_file, '.' );
if( temp ) if( temp )
*temp = '\0'; *temp = '\0';
...@@ -687,21 +687,17 @@ static int vlc_sd_probe_Open( vlc_object_t *obj ) ...@@ -687,21 +687,17 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
{ {
msg_Warn( probe, "No 'descriptor' function in '%s'", psz_filename ); msg_Warn( probe, "No 'descriptor' function in '%s'", psz_filename );
lua_pop( L, 1 ); lua_pop( L, 1 );
if( !( psz_longname = strdup( *ppsz_file ) ) ) psz_longname = *ppsz_file;
{
free( psz_filename );
goto error;
}
} }
else else
{ {
lua_getfield( L, -1, "title" ); lua_getfield( L, -1, "title" );
if( !lua_isstring( L, -1 ) || if( !lua_isstring( L, -1 ) )
!( psz_longname = strdup( lua_tostring( L, -1 ) ) ) )
{ {
free( psz_filename ); free( psz_filename );
goto error; goto error;
} }
psz_longname = lua_tostring( L, -1 );
} }
char *psz_file_esc = config_StringEscape( *ppsz_file ); char *psz_file_esc = config_StringEscape( *ppsz_file );
...@@ -712,14 +708,12 @@ static int vlc_sd_probe_Open( vlc_object_t *obj ) ...@@ -712,14 +708,12 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
free( psz_file_esc ); free( psz_file_esc );
free( psz_longname_esc ); free( psz_longname_esc );
free( psz_filename ); free( psz_filename );
free( psz_longname );
goto error; goto error;
} }
free( psz_file_esc ); free( psz_file_esc );
free( psz_longname_esc ); free( psz_longname_esc );
vlc_sd_probe_Add( probe, psz_name, psz_longname, SD_CAT_INTERNET ); vlc_sd_probe_Add( probe, psz_name, psz_longname, SD_CAT_INTERNET );
free( psz_name ); free( psz_name );
free( psz_longname );
free( psz_filename ); free( psz_filename );
lua_close( L ); lua_close( L );
} }
......
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