[MPlayer-cvslog] r27875 - trunk/libass/ass_fontconfig.c

reimar subversion at mplayerhq.hu
Sun Nov 2 10:57:23 CET 2008


Author: reimar
Date: Sun Nov  2 10:57:22 2008
New Revision: 27875

Log:
Fallback to non-fontconfig behaviour when fontconfig initialization fails.
Also fixes a memleak in that case, bug #1313.


Modified:
   trunk/libass/ass_fontconfig.c

Modified: trunk/libass/ass_fontconfig.c
==============================================================================
--- trunk/libass/ass_fontconfig.c	(original)
+++ trunk/libass/ass_fontconfig.c	Sun Nov  2 10:57:22 2008
@@ -407,10 +407,7 @@ fc_instance_t* fontconfig_init(ass_libra
 	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_libra
 	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_libra
 	}
 
 	priv->family_default = family ? strdup(family) : 0;
+exit:
 	priv->path_default = path ? strdup(path) : 0;
 	priv->index_default = 0;
 



More information about the MPlayer-cvslog mailing list