summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-28 14:02:19 +0200
committerwm4 <wm4@nowhere>2015-08-28 14:07:06 +0200
commitb658669c0df5ef3adacd92cc29a9e679bd8bdd2f (patch)
tree1fd5485d94d776b28cb510c518682b744e3f1981
parentd164226a4c1c6c29951819862d505161065eed6f (diff)
downloadlibass-b658669c0df5ef3adacd92cc29a9e679bd8bdd2f.tar.bz2
libass-b658669c0df5ef3adacd92cc29a9e679bd8bdd2f.tar.xz
fontconfig: fix error checking
FcInitLoadConfig() could faul, leaving rc=1 and fc->config=NULL, making FcConfigBuildFonts() potentially crash. Also, the FcConfigBuildFonts() return value was not checked.
-rw-r--r--libass/ass_fontconfig.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index 50ce6c5..0c89d36 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -271,10 +271,9 @@ ass_fontconfig_add_provider(ASS_Library *lib, ASS_FontSelector *selector,
"file found, using fallback.");
FcConfigDestroy(fc->config);
fc->config = FcInitLoadConfig();
- rc++;
}
- if (rc)
- FcConfigBuildFonts(fc->config);
+ if (fc->config)
+ rc = FcConfigBuildFonts(fc->config);
if (!rc || !fc->config) {
ass_msg(lib, MSGL_FATAL,