[vlc-devel] commit: Fix potential segfault introduced by myself (CID 263) ( Rémi Duraffort )

git version control git at videolan.org
Wed Oct 8 22:01:17 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Oct  8 21:51:30 2008 +0200| [fc4b7b3c685148fbde7c6569e67b9fb8ccf66e26] | committer: Rémi Duraffort 

Fix potential segfault introduced by myself (CID 263)

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

 modules/demux/subtitle.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 0d9e673..61b2311 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -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 */




More information about the vlc-devel mailing list