]> git.sesse.net Git - vlc/commitdiff
Fix memleaks (CID 211)
authorRémi Duraffort <ivoire@videolan.org>
Wed, 1 Oct 2008 19:17:48 +0000 (21:17 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 1 Oct 2008 19:17:48 +0000 (21:17 +0200)
modules/demux/subtitle.c

index 485ae294cb764a3faf3241662b4cbe6acc63b539..963181b281ff4aaa3a14e9ce6c40e171fbf32767 100644 (file)
@@ -1463,7 +1463,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
 
         const char *s = TextGetLine( txt );
         if( !s )
+        {
+            free( psz_text );
             return VLC_EGENERIC;
+        }
 
         if( strstr( s, "FORMAT" ) )
         {
@@ -1475,7 +1478,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
 
             psz_temp = malloc( strlen(s) );
             if( !psz_temp )
+            {
+                free( psz_text );
                 return VLC_ENOMEM;
+            }
 
             if( sscanf( s, "FORMAT=%[^\r\n]", psz_temp ) )
             {
@@ -1508,7 +1514,10 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
         const char *s = TextGetLine( txt );
 
         if( !s )
+        {
+            free( psz_text );
             return VLC_EGENERIC;
+        }
 
         int i_len = strlen( s );
         if( i_len == 0 )