From: reimar Date: Sun, 2 Nov 2008 09:57:22 +0000 (+0000) Subject: Fallback to non-fontconfig behaviour when fontconfig initialization fails. X-Git-Tag: 0.9.7~176 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6012a37793663082049bfdcec711ae9ddd2b740;p=libass Fallback to non-fontconfig behaviour when fontconfig initialization fails. Also fixes a memleak in that case, bug #1313. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27875 b3059339-0415-0410-9bf9-f77b7e298cf2 --- diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index fa15087..5edbdec 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -407,10 +407,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con if (!fc) { mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed); - priv->config = NULL; - priv->path_default = strdup(path); - priv->index_default = 0; - return priv; + goto exit; } rc = FcInit(); @@ -419,7 +416,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con priv->config = FcConfigGetCurrent(); if (!priv->config) { mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed); - return 0; + goto exit; } for (i = 0; i < library->num_fontdata; ++i) @@ -468,6 +465,7 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con } priv->family_default = family ? strdup(family) : 0; +exit: priv->path_default = path ? strdup(path) : 0; priv->index_default = 0;