- playlist_item_t *p_item;
- char *psz_mrl = malloc( strlen( SHOUTCAST_BASE_URL )
- + strlen( "?genre=" ) + strlen( psz_name ) + 1 );
- sprintf( psz_mrl, SHOUTCAST_BASE_URL "?genre=%s",
- psz_name );
- p_item = playlist_ItemNew( p_sys->p_playlist, psz_mrl,
- psz_name );
- free( psz_mrl );
- playlist_NodeAddItem( p_sys->p_playlist, p_item,
- p_sys->p_current->pp_parents[0]->i_view,
- p_sys->p_current, PLAYLIST_APPEND,
- PLAYLIST_END );
-
- /* We need to declare the parents of the node as the
- * * same of the parent's ones */
- playlist_CopyParents( p_sys->p_current, p_item );
-
- vlc_input_item_CopyOptions( &p_sys->p_current->input,
- &p_item->input );
-
- FREE( psz_name );
+ char* psz_mrl;
+ if( asprintf( &psz_mrl, SHOUTCAST_BASE_URL "?genre=%s",
+ psz_name ) != -1 )
+ {
+ p_input = input_item_New( p_demux, psz_mrl, psz_name );
+ input_item_CopyOptions( p_sys->p_current_input, p_input );
+ free( psz_mrl );
+ input_item_AddSubItem( p_sys->p_current_input, p_input );
+ vlc_gc_decref( p_input );
+ }
+ FREENULL( psz_name );