Commit 3806ea87 authored by Ilkka Ollakka's avatar Ilkka Ollakka

freetype: add more error-checking

should not crash if font family not found. Thanks to Anthony Loiseau for
spotting this one.
parent 9543a6ab
...@@ -361,13 +361,24 @@ static int Create( vlc_object_t *p_this ) ...@@ -361,13 +361,24 @@ static int Create( vlc_object_t *p_this )
FcDefaultSubstitute( fontpattern ); FcDefaultSubstitute( fontpattern );
fontmatch = FcFontMatch( NULL, fontpattern, &fontresult ); fontmatch = FcFontMatch( NULL, fontpattern, &fontresult );
if( fontmatch == FcResultNoMath )
{
free( psz_fontsize );
FcPatternDestroy( fontpattern );
FcPatternDestroy( fontmatch );
goto error;
}
FcPatternGetString( fontmatch, FC_FILE, 0, (FcChar8 **)&psz_fontfile); FcPatternGetString( fontmatch, FC_FILE, 0, (FcChar8 **)&psz_fontfile);
FcPatternGetInteger( fontmatch, FC_INDEX, 0, &fontindex ); FcPatternGetInteger( fontmatch, FC_INDEX, 0, &fontindex );
free( psz_fontsize );
if( !psz_fontfile ) if( !psz_fontfile )
{
FcPatternDestroy( fontpattern );
FcPatternDestroy( fontmatch );
goto error; goto error;
}
msg_Dbg( p_filter, "Using %s as font from file %s", psz_fontfamily, psz_fontfile); msg_Dbg( p_filter, "Using %s as font from file %s", psz_fontfamily, psz_fontfile);
free( psz_fontsize );
#else #else
psz_fontfile = psz_fontfamily; psz_fontfile = psz_fontfamily;
#endif #endif
......
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