]> git.sesse.net Git - vlc/commitdiff
Fix potential segfault introduced by myself (CID 263)
authorRémi Duraffort <ivoire@videolan.org>
Wed, 8 Oct 2008 19:51:30 +0000 (21:51 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 8 Oct 2008 20:00:53 +0000 (22:00 +0200)
modules/demux/subtitle.c

index 0d9e6730bdf5465279c9e99e01d2f0b87cd9f1f2..61b2311bcde6ae0fb2a8e48d77f7578ea07d3305 100644 (file)
@@ -1853,12 +1853,10 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
         int h1 = 0, m1 = 0, s1 = 0, f1 = 0;
         int h2 = 0, m2 = 0, s2 = 0, f2 = 0;
         const char *s = TextGetLine( txt );
+        free( psz_text );
 
         if( !s )
-        {
-            free( psz_text );
             return VLC_EGENERIC;
-        }
 
         psz_text = malloc( strlen( s ) + 1 );
         if( !psz_text )
@@ -1879,7 +1877,6 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
                               psz_begin, psz_text ) != 2) )
                 /* Line is not recognized */
             {
-                free( psz_text );
                 continue;
             }
 
@@ -1897,12 +1894,6 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
             }
             break;
         }
-        /* Line is not recognized */
-        else
-        {
-            free( psz_text );
-            continue;
-        }
     }
 
     /* Get the following Lines */