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

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


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed May 24 12:35:34 2017 +0200| [3fe69299a738d29abd01d4dd4c6256a70e6cff85] | committer: Hugo Beauzée-Luyssen

Revert "subtitle: Fix potential memory leaks"

This reverts commit c2e45c4ecf2d51820dfe095d89e8b9379c8df4ca.

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

 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 9b417ce454..9726bc26bb 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1689,7 +1689,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
                      text_t *txt, subtitle_t *p_subtitle, size_t i_idx )
 {
     VLC_UNUSED( i_idx );
-    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;
 
@@ -1705,7 +1705,6 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
     /* Parse the main lines */
     for( ;; )
     {
-        free( psz_orig );
         const char *s = TextGetLine( txt );
         if( !s )
             return VLC_EGENERIC;
@@ -1796,10 +1795,16 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
                 sscanf( &psz_text[shift], "%d", &p_props->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