[vlc-commits] http: fix corner case memory leaks

Rémi Denis-Courmont git at videolan.org
Wed Apr 23 18:33:03 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 23 19:32:11 2014 +0300| [04509ed82c593219182e80696d470e4f82d897c0] | committer: Rémi Denis-Courmont

http: fix corner case memory leaks

STANDARD_READ_ACCESS_INIT is an evil macro.
Also the forward-cookies setting could change, hence inherit -> create-get.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04509ed82c593219182e80696d470e4f82d897c0
---

 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 3908fb7..67431cf 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -240,10 +240,6 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
     access_sys_t *p_sys;
     char         *psz, *p;
 
-    /* Only forward an store cookies if the corresponding option is activated */
-    bool   b_forward_cookies = var_InheritBool( p_access, "http-forward-cookies" );
-    vlc_array_t * saved_cookies = b_forward_cookies ? (cookies ? cookies : vlc_array_new()) : NULL;
-
     /* Set up p_access */
     STANDARD_READ_ACCESS_INIT;
 #ifdef HAVE_ZLIB_H
@@ -286,7 +282,11 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
     p_access->info.i_pos  = 0;
     p_access->info.b_eof  = false;
 
-    p_sys->cookies = saved_cookies;
+    /* Only forward an store cookies if the corresponding option is activated */
+    if( var_CreateGetBool( p_access, "http-forward-cookies" ) )
+        p_sys->cookies = (cookies != NULL) ? cookies : vlc_array_new();
+    else
+        p_sys->cookies = NULL;
 
     http_auth_Init( &p_sys->auth );
     http_auth_Init( &p_sys->proxy_auth );



More information about the vlc-commits mailing list