[vlc-commits] xiph: simplify and fix leak

Rémi Denis-Courmont git at videolan.org
Sat Aug 22 09:11:02 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 22 10:10:37 2015 +0300| [6253e94caacb27d81d741717f4f730b34cf78307] | committer: Rémi Denis-Courmont

xiph: simplify and fix leak

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

 modules/demux/xiph_metadata.c |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/modules/demux/xiph_metadata.c b/modules/demux/xiph_metadata.c
index e4ef767..fe8c183 100644
--- a/modules/demux/xiph_metadata.c
+++ b/modules/demux/xiph_metadata.c
@@ -306,27 +306,14 @@ void vorbis_ParseComment( es_format_t *p_fmt, vlc_meta_t **pp_meta,
         else if ( ppf_replay_gain && ppf_replay_peak && !strncmp(psz_comment, "REPLAYGAIN_", 11) )
         {
             char *p = strchr( psz_comment, '=' );
-            char *psz_val;
             if (!p) continue;
             if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) )
             {
-                psz_val = malloc( strlen(p+1) + 1 );
-                if (!psz_val) continue;
-                if( sscanf( ++p, "%s dB", psz_val ) == 1 )
-                {
-                    (*ppf_replay_gain)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_val );
-                    free( psz_val );
-                }
+                (*ppf_replay_gain)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p );
             }
             else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) )
             {
-                psz_val = malloc( strlen(p+1) + 1 );
-                if (!psz_val) continue;
-                if( sscanf( ++p, "%s dB", psz_val ) == 1 )
-                {
-                    (*ppf_replay_gain)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_val );
-                    free( psz_val );
-                }
+                (*ppf_replay_gain)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p );
             }
             else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) )
             {



More information about the vlc-commits mailing list