[vlc-commits] http: fix memory leak in the error path

Rémi Duraffort git at videolan.org
Sun Mar 4 20:28:07 CET 2012


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Mar  4 19:25:32 2012 +0100| [69ee998d3c9fe363b1af52ba3ee20fcd2c0a8b0f] | committer: Rémi Duraffort

http: fix memory leak in the error path

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

 modules/access/http.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index cc1ec82..a292ebb 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -917,13 +917,11 @@ static int ReadICYMeta( access_t *p_access )
     for( i_read = 0; i_read < i_size; )
     {
         int i_tmp;
-        if( ReadData( p_access, &i_tmp, (uint8_t *)&psz_meta[i_read], i_size - i_read ) )
+        if( ReadData( p_access, &i_tmp, (uint8_t *)&psz_meta[i_read], i_size - i_read ) || i_tmp <= 0 )
         {
             free( psz_meta );
             return VLC_EGENERIC;
         }
-        if( i_tmp <= 0 )
-            return VLC_EGENERIC;
         i_read += i_tmp;
     }
     psz_meta[i_read] = '\0'; /* Just in case */



More information about the vlc-commits mailing list