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

git version control git at videolan.org
Fri Oct 10 01:45:21 CEST 2008


vlc | branch: 0.9-bugfix | Rémi Duraffort <ivoire at videolan.org> | Wed Oct  8 21:51:30 2008 +0200| [bde096d883149381a67b14d99cca14d021939811] | committer: Derk-Jan Hartman 

Fix potential segfault introduced by myself (CID 263)
(cherry picked from commit fc4b7b3c685148fbde7c6569e67b9fb8ccf66e26)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

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

 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 68fbf89..3f029cb 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1849,12 +1849,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 )
@@ -1875,7 +1873,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;
             }
 
@@ -1893,12 +1890,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