[vlc-commits] old http: fix leak on reconnect
Rémi Denis-Courmont
git at videolan.org
Wed Oct 4 19:00:32 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 4 19:58:39 2017 +0300| [9bc4991ebcb02d477bea1f75b2f6d9e90c8ee77a] | committer: Rémi Denis-Courmont
old http: fix leak on reconnect
The auth state machine must be reinitialized at every connection.
NOTE: There are still (probably, untested) leaks if HTTP response
contains multiple auth-related header lines with the same name.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bc4991ebcb02d477bea1f75b2f6d9e90c8ee77a
---
modules/access/http.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/access/http.c b/modules/access/http.c
index 916427e2be..1ace2db902 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -189,8 +189,6 @@ static int Open( vlc_object_t *p_this )
if( p_sys->url.i_port <= 0 )
p_sys->url.i_port = 80;
- vlc_http_auth_Init( &p_sys->auth );
- vlc_http_auth_Init( &p_sys->proxy_auth );
vlc_credential_init( &credential, &p_sys->url );
/* Determine the HTTP user agent */
@@ -385,10 +383,8 @@ static void Close( vlc_object_t *p_this )
access_sys_t *p_sys = p_access->p_sys;
vlc_UrlClean( &p_sys->url );
- vlc_http_auth_Deinit( &p_sys->auth );
if( p_sys->b_proxy )
vlc_UrlClean( &p_sys->proxy );
- vlc_http_auth_Deinit( &p_sys->proxy_auth );
free( p_sys->psz_mime );
free( p_sys->psz_location );
@@ -642,7 +638,8 @@ static int Connect( stream_t *p_access )
free( p_sys->psz_icy_name );
free( p_sys->psz_icy_title );
-
+ vlc_http_auth_Init( &p_sys->auth );
+ vlc_http_auth_Init( &p_sys->proxy_auth );
p_sys->psz_location = NULL;
p_sys->psz_mime = NULL;
p_sys->i_icy_meta = 0;
@@ -987,6 +984,9 @@ static void Disconnect( stream_t *p_access )
if( p_sys->fd != -1)
net_Close(p_sys->fd);
p_sys->fd = -1;
+
+ vlc_http_auth_Deinit( &p_sys->auth );
+ vlc_http_auth_Deinit( &p_sys->proxy_auth );
}
/*****************************************************************************
More information about the vlc-commits
mailing list