Commit 6f8c9706 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Do not leak the art handler from HTTP interface - fixes #1308

parent e67567c4
......@@ -159,6 +159,7 @@ static int Open( vlc_object_t *p_this )
p_sys->p_vlm = NULL;
p_sys->psz_address = psz_address;
p_sys->i_port = i_port;
p_sys->p_art_handler = NULL;
/* determine Content-Type value for HTML pages */
psz_src = config_GetPsz( p_intf, "http-charset" );
......@@ -344,6 +345,14 @@ static int Open( vlc_object_t *p_this )
}
E_(ParseDirectory)( p_intf, psz_src, psz_src );
if( p_sys->i_files <= 0 )
{
msg_Err( p_intf, "cannot find any file in directory %s", psz_src );
goto failed;
}
p_intf->pf_run = Run;
free( psz_src );
if( config_GetInt( p_intf, "http-album-art" ) )
{
......@@ -361,17 +370,9 @@ static int Open( vlc_object_t *p_this )
h->p_handler = httpd_HandlerNew( p_sys->p_httpd_host,
"/art", NULL, NULL, NULL,
E_(ArtCallback), h );
TAB_APPEND( p_sys->i_handlers, p_sys->pp_handlers, h->p_handler );
p_sys->p_art_handler = h->p_handler;
}
if( p_sys->i_files <= 0 )
{
msg_Err( p_intf, "cannot find any file in directory %s", psz_src );
goto failed;
}
p_intf->pf_run = Run;
free( psz_src );
return VLC_SUCCESS;
failed:
......@@ -434,6 +435,8 @@ static void Close ( vlc_object_t *p_this )
}
if( p_sys->i_handlers )
free( p_sys->pp_handlers );
if( p_sys->p_art_handler )
httpd_HandlerDelete( p_sys->p_art_handler );
httpd_HostDelete( p_sys->p_httpd_host );
free( p_sys->psz_address );
free( p_sys->psz_html_type );
......
......@@ -382,6 +382,7 @@ struct intf_sys_t
int i_handlers;
http_association_t **pp_handlers;
httpd_handler_t *p_art_handler;
playlist_t *p_playlist;
input_thread_t *p_input;
......
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