]> git.sesse.net Git - vlc/commitdiff
Do not leak the art handler from HTTP interface - fixes #1308
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 23 Sep 2007 07:28:12 +0000 (07:28 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 23 Sep 2007 07:28:12 +0000 (07:28 +0000)
modules/control/http/http.c
modules/control/http/http.h

index d4c780c63ef651a09077dfd349d6f29bffc78543..bebc4762842663089ba052174d91cf8c7b29052c 100644 (file)
@@ -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 );
index 9e4f8fc4ed3dc9bb7d56612da4466a3d2d12b132..1f801fb7be5c287d797633db81a0149d13de85af 100644 (file)
@@ -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;