Commit e0c7dbab authored by Laurent Aimar's avatar Laurent Aimar

* http: fixed mem leaks, doesn't add '\0' anymore at the end of files.

parent bccdae12
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c : http mini-server ;) * http.c : http mini-server ;)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: http.c,v 1.48 2004/01/17 16:51:54 gbazin Exp $ * $Id: http.c,v 1.49 2004/01/18 07:35:31 fenrir Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -1026,6 +1026,10 @@ static mvar_t *mvar_HttpdInfoSetNew( char *name, httpd_t *p_httpd, int i_type ) ...@@ -1026,6 +1026,10 @@ static mvar_t *mvar_HttpdInfoSetNew( char *name, httpd_t *p_httpd, int i_type )
free( info.info[i].psz_name ); free( info.info[i].psz_name );
free( info.info[i].psz_value ); free( info.info[i].psz_value );
} }
if( info.i_count > 0 )
{
free( info.info );
}
return s; return s;
} }
...@@ -2286,7 +2290,7 @@ static int http_get( httpd_file_callback_args_t *p_args, ...@@ -2286,7 +2290,7 @@ static int http_get( httpd_file_callback_args_t *p_args,
p += sprintf( p, "</body>\n" ); p += sprintf( p, "</body>\n" );
p += sprintf( p, "</html>\n" ); p += sprintf( p, "</html>\n" );
*pi_data = strlen( *pp_data ) + 1; *pi_data = strlen( *pp_data );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -2364,11 +2368,12 @@ static int http_get( httpd_file_callback_args_t *p_args, ...@@ -2364,11 +2368,12 @@ static int http_get( httpd_file_callback_args_t *p_args,
/* we parse executing all <vlc /> macros */ /* we parse executing all <vlc /> macros */
Execute( p_args, p_request, i_request, pp_data, pi_data, &dst, &p_buffer[0], &p_buffer[i_buffer] ); Execute( p_args, p_request, i_request, pp_data, pi_data, &dst, &p_buffer[0], &p_buffer[i_buffer] );
*dst++ = '\0'; *dst = '\0';
*pi_data = dst - *pp_data; *pi_data = dst - *pp_data;
SSClean( &p_args->stack ); SSClean( &p_args->stack );
mvar_Delete( p_args->vars ); mvar_Delete( p_args->vars );
free( p_buffer );
} }
fclose( f ); fclose( f );
......
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