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

Timothy B. Terriberry git at videolan.org
Thu Sep 5 15:44:06 CEST 2013


vlc/vlc-2.1 | branch: master | Timothy B. Terriberry <tterribe at xiph.org> | Mon Sep  2 09:27:13 2013 -0700| [93772ba824e5abf35f3283cf3916bd96d214ccab] | 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>
(cherry picked from commit d9a00b1ec0b51bfb157e4486920af3521a06989d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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