Commit 6ce39aaa authored by Bernie Purcell's avatar Bernie Purcell

Copy across damienf's mod to freetype.c in r21422 to balance vlc_object_find()

with vlc_object_release(). Also copied across some Null pointer checks.
parent 949c3495
...@@ -202,7 +202,10 @@ static int LoadFontsFromAttachments( filter_t *p_filter ) ...@@ -202,7 +202,10 @@ static int LoadFontsFromAttachments( filter_t *p_filter )
return VLC_EGENERIC; return VLC_EGENERIC;
if( VLC_SUCCESS != input_Control( p_input, INPUT_GET_ATTACHMENTS, &pp_attachments, &i_attachments_cnt )) if( VLC_SUCCESS != input_Control( p_input, INPUT_GET_ATTACHMENTS, &pp_attachments, &i_attachments_cnt ))
{
vlc_object_release(p_input);
return VLC_EGENERIC; return VLC_EGENERIC;
}
p_sys->i_fonts = 0; p_sys->i_fonts = 0;
p_sys->p_fonts = malloc( i_attachments_cnt * sizeof( ATSFontContainerRef ) ); p_sys->p_fonts = malloc( i_attachments_cnt * sizeof( ATSFontContainerRef ) );
...@@ -238,6 +241,8 @@ static int LoadFontsFromAttachments( filter_t *p_filter ) ...@@ -238,6 +241,8 @@ static int LoadFontsFromAttachments( filter_t *p_filter )
} }
free( pp_attachments ); free( pp_attachments );
vlc_object_release(p_input);
return rv; return rv;
} }
...@@ -454,6 +459,9 @@ static int PushFont( font_stack_t **p_font, const char *psz_name, int i_size, ...@@ -454,6 +459,9 @@ static int PushFont( font_stack_t **p_font, const char *psz_name, int i_size,
return VLC_EGENERIC; return VLC_EGENERIC;
p_new = malloc( sizeof( font_stack_t ) ); p_new = malloc( sizeof( font_stack_t ) );
if( ! p_new )
return VLC_ENOMEM;
p_new->p_next = NULL; p_new->p_next = NULL;
if( psz_name ) if( psz_name )
...@@ -565,7 +573,7 @@ static void ProcessNodes( filter_t *p_filter, xml_reader_t *p_xml_reader, ...@@ -565,7 +573,7 @@ static void ProcessNodes( filter_t *p_filter, xml_reader_t *p_xml_reader,
if( p_font_style ) if( p_font_style )
{ {
PushFont( &p_fonts, rv = PushFont( &p_fonts,
p_font_style->psz_fontname, p_font_style->psz_fontname,
p_font_style->i_font_size, p_font_style->i_font_size,
p_font_style->i_font_color, p_font_style->i_font_color,
...@@ -580,8 +588,13 @@ static void ProcessNodes( filter_t *p_filter, xml_reader_t *p_xml_reader, ...@@ -580,8 +588,13 @@ static void ProcessNodes( filter_t *p_filter, xml_reader_t *p_xml_reader,
} }
else else
{ {
PushFont( &p_fonts, p_sys->psz_font_name, p_sys->i_font_size, p_sys->i_font_color, 0 ); rv = PushFont( &p_fonts,
p_sys->psz_font_name,
p_sys->i_font_size,
p_sys->i_font_color, 0 );
} }
if( rv != VLC_SUCCESS )
return rv;
while ( ( xml_ReaderRead( p_xml_reader ) == 1 ) ) while ( ( xml_ReaderRead( p_xml_reader ) == 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