[vlc-devel] commit: freetype: add more error-checking (Ilkka Ollakka )
git version control
git at videolan.org
Tue Jul 28 15:07:03 CEST 2009
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Jul 28 16:04:49 2009 +0300| [3806ea8716699db7c29ded51f76a694f7bfde18b] | committer: Ilkka Ollakka
freetype: add more error-checking
should not crash if font family not found. Thanks to Anthony Loiseau for
spotting this one.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3806ea8716699db7c29ded51f76a694f7bfde18b
---
modules/misc/freetype.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 0dc3143..f41630b 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -361,13 +361,24 @@ static int Create( vlc_object_t *p_this )
FcDefaultSubstitute( fontpattern );
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);
FcPatternGetInteger( fontmatch, FC_INDEX, 0, &fontindex );
+ free( psz_fontsize );
if( !psz_fontfile )
+ {
+ FcPatternDestroy( fontpattern );
+ FcPatternDestroy( fontmatch );
goto error;
+ }
msg_Dbg( p_filter, "Using %s as font from file %s", psz_fontfamily, psz_fontfile);
- free( psz_fontsize );
#else
psz_fontfile = psz_fontfamily;
#endif
More information about the vlc-devel
mailing list