[vlc-commits] Fix a memory leak in ParseVorbisComments().

Timothy B. Terriberry git at videolan.org
Mon Sep 2 20:45:07 CEST 2013


vlc | branch: master | Timothy B. Terriberry <tterribe at xiph.org> | Mon Sep  2 09:27:13 2013 -0700| [d9a00b1ec0b51bfb157e4486920af3521a06989d] | committer: Jean-Baptiste Kempf

Fix a memory leak in ParseVorbisComments().

Also, don't abort parsing the rest of the comments if we encounter
an empty one.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/vorbis.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 9f3bd47..0d2f020 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -569,15 +569,12 @@ static void ParseVorbisComments( decoder_t *p_dec )
             break;
         psz_name = psz_comment;
         psz_value = strchr( psz_comment, '=' );
-        if( psz_value )
+        /* Don't add empty values */
+        if( psz_value && psz_value[1] != '\0')
         {
             *psz_value = '\0';
             psz_value++;
 
-            /* Don't add empty values */
-            if( *psz_value == '\0' )
-                break;
-
             if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_GAIN" ) ||
                 !strcasecmp( psz_name, "RG_RADIO" ) )
             {



More information about the vlc-commits mailing list