changeset 27841:29d72a47da0c

Fallback to non-fontconfig behaviour when fontconfig initialization fails. Also fixes a memleak in that case, bug #1313.
author reimar
date Sun, 02 Nov 2008 09:57:22 +0000
parents 0073bd183787
children c03685299634
files libass/ass_fontconfig.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_fontconfig.c	Sat Nov 01 13:56:11 2008 +0000
+++ b/libass/ass_fontconfig.c	Sun Nov 02 09:57:22 2008 +0000
@@ -407,10 +407,7 @@
 	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 @@
 	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 @@
 	}
 
 	priv->family_default = family ? strdup(family) : 0;
+exit:
 	priv->path_default = path ? strdup(path) : 0;
 	priv->index_default = 0;