]> git.sesse.net Git - vlc/blobdiff - modules/control/http/http.c
control http: fix memleak.
[vlc] / modules / control / http / http.c
index 877c0e71979e9b5e1ff432857dda0290fbaf521a..54cce0bfa75cf51f11920d5c6d144427833f741e 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>
@@ -29,6 +28,8 @@
 #include "http.h"
 #include <vlc_plugin.h>
 
+#include <assert.h>
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -120,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;
@@ -218,6 +219,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 );
@@ -336,13 +342,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 )
@@ -599,7 +604,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;