[vlc-commits] Revert "subtitle: Fix potential memory leaks"

Hugo Beauzée-Luyssen git at videolan.org
Wed May 24 12:39:29 CEST 2017


vlc/vlc-2.2 | branch: refs/tags/2.2.6 | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May 24 12:36:19 2017 +0200| [dbe888f9ca9c3b102478b4a16a3d1d985c267899] | committer: Hugo Beauzée-Luyssen

Revert "subtitle: Fix potential memory leaks"

This reverts commit 85f38701259e07a843a7ee1dd51959151a7bb050.

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

 modules/demux/subtitle.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index c4402edfb9..3e40f28065 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1667,7 +1667,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
 
     demux_sys_t  *p_sys = p_demux->p_sys;
     text_t       *txt = &p_sys->txt;
-    char         *psz_text, *psz_orig = NULL;
+    char         *psz_text, *psz_orig;
     char         *psz_text2, *psz_orig2;
     int h1, h2, m1, m2, s1, s2, f1, f2;
 
@@ -1683,7 +1683,6 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
     /* Parse the main lines */
     for( ;; )
     {
-        free(psz_orig);
         const char *s = TextGetLine( txt );
         if( !s )
             return VLC_EGENERIC;
@@ -1774,10 +1773,16 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
                 sscanf( &psz_text[shift], "%d", &p_sys->jss.i_time_resolution );
                 break;
             }
+            free( psz_orig );
+            continue;
+        }
+        else
+            /* Unkown type line, probably a comment */
+        {
+            free( psz_orig );
+            continue;
         }
     }
-    free( psz_orig );
-    psz_orig = NULL;
 
     while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
     {



More information about the vlc-commits mailing list