Commit c2e45c4e authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

subtitle: Fix potential memory leaks

parent 7a726a53
...@@ -1689,7 +1689,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props, ...@@ -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 ) text_t *txt, subtitle_t *p_subtitle, size_t i_idx )
{ {
VLC_UNUSED( i_idx ); VLC_UNUSED( i_idx );
char *psz_text, *psz_orig; char *psz_text, *psz_orig = NULL;
char *psz_text2, *psz_orig2; char *psz_text2, *psz_orig2;
int h1, h2, m1, m2, s1, s2, f1, f2; int h1, h2, m1, m2, s1, s2, f1, f2;
...@@ -1705,6 +1705,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props, ...@@ -1705,6 +1705,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
/* Parse the main lines */ /* Parse the main lines */
for( ;; ) for( ;; )
{ {
free( psz_orig );
const char *s = TextGetLine( txt ); const char *s = TextGetLine( txt );
if( !s ) if( !s )
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -1795,16 +1796,10 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props, ...@@ -1795,16 +1796,10 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
sscanf( &psz_text[shift], "%d", &p_props->jss.i_time_resolution ); sscanf( &psz_text[shift], "%d", &p_props->jss.i_time_resolution );
break; 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 ] == '\\' ) while( psz_text[ strlen( psz_text ) - 1 ] == '\\' )
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment