vlc/vlc-2.2 | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Thu May 18 16:08:25 2017 +0200| [85f38701259e07a843a7ee1dd51959151a7bb050] | committer: Hugo Beauzée-Luyssen
subtitle: Fix potential memory leaks (cherry picked from commit c2e45c4ecf2d51820dfe095d89e8b9379c8df4ca) Signed-off-by: Hugo Beauzée-Luyssen <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=85f38701259e07a843a7ee1dd51959151a7bb050 --- modules/demux/subtitle.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c index 3e40f28065..c4402edfb9 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; + char *psz_text, *psz_orig = NULL; char *psz_text2, *psz_orig2; int h1, h2, m1, m2, s1, s2, f1, f2; @@ -1683,6 +1683,7 @@ 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; @@ -1773,16 +1774,10 @@ 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 ] == '\\' ) { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
