]> git.sesse.net Git - vlc/blobdiff - modules/control/http/http.c
Potential memleak.
[vlc] / modules / control / http / http.c
index 9aab7046ffe3b67e791c9eb04c2b61077ac3a7ce..1b1796a1c6b6a1915292e9129bd3a1508df39e9d 100644 (file)
@@ -2,7 +2,6 @@
  * http.c : HTTP/HTTPS Remote control interface
  *****************************************************************************
  * Copyright (C) 2001-2006 the VideoLAN team
- * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -122,7 +121,7 @@ static int Open( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     intf_sys_t    *p_sys;
     char          *psz_address;
-    const char    *psz_cert = NULL, *psz_key = NULL, *psz_ca = NULL,
+    char          *psz_cert = NULL, *psz_key = NULL, *psz_ca = NULL,
                   *psz_crl = NULL;
     int           i_port       = 0;
     char          *psz_src = NULL;
@@ -143,6 +142,7 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
     if( !p_intf->p_sys )
     {
+        free( psz_address );
         return( VLC_ENOMEM );
     }
 
@@ -220,6 +220,11 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_httpd_host = httpd_TLSHostNew( VLC_OBJECT(p_intf), psz_address,
                                             i_port, psz_cert, psz_key, psz_ca,
                                             psz_crl );
+    free( psz_cert );
+    free( psz_key );
+    free( psz_ca );
+    free( psz_crl );
+
     if( p_sys->p_httpd_host == NULL )
     {
         msg_Err( p_intf, "cannot listen on %s:%d", psz_address, i_port );
@@ -338,13 +343,12 @@ static void Close ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
     intf_sys_t    *p_sys = p_intf->p_sys;
-
     int i;
 
+#ifdef ENABLE_VLM
     if( p_sys->p_vlm )
-    {
         vlm_Delete( p_sys->p_vlm );
-    }
+#endif
     for( i = 0; i < p_sys->i_files; i++ )
     {
         if( p_sys->pp_files[i]->b_handler )
@@ -601,7 +605,7 @@ int  HandlerCallback( httpd_handler_sys_t *p_args,
     char *p_url = (char *)_p_url;
     char *p_request = (char *)_p_request;
     char **pp_data = (char **)_pp_data;
-    char *p_in = (char *)p_in;
+    char *p_in = (char *)_p_in;
     int i_request = p_request != NULL ? strlen( p_request ) : 0;
     char *p;
     int i_env = 0;