From 5c90509c073b3879fd9e3a2dc9dddeb724757ccf Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Wed, 12 Apr 2006 02:38:28 +0000 Subject: [PATCH] Don't crash if config is null (Coverity defect #984). --- ChangeLog | 13 +++++++++---- src/fccache.c | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5647a49..a5eec3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,23 @@ +2006-04-11 Patrick Lam + * src/fccache.c (FcGlobalCacheReadDir): + + Don't crash if config is null (Coverity defect #984). + 2006-04-11 Frederic Crozat reviewed by: plam - * src/fccharset.c: (FcCharSetPutLeaf): - * src/fclang.c: (FcNameUnparseLangSet): + * src/fccharset.c (FcCharSetPutLeaf): + * src/fclang.c (FcNameUnparseLangSet): Missing bits from previous patches. * src/fccharset.c (FcCharSetSubtractCount): Remove extra semi-colon. - * src/fccfg.c: (FcConfigBuildFonts): + * src/fccfg.c (FcConfigBuildFonts): Fix memory leak in error case (Coverity defects #776, #985). - * src/fcxml.c: (FcPopBinary, FcParsePatelt, FcParsePattern): + * src/fcxml.c (FcPopBinary, FcParsePatelt, FcParsePattern): Fix memory leaks (Coverity defects #779, #781) and memory use after free (Coverity defect #780). diff --git a/src/fccache.c b/src/fccache.c index 23c37f1..58f925d 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -320,8 +320,9 @@ FcGlobalCacheReadDir (FcFontSet *set, FcStrSet *dirs, FcGlobalCache * cache, con if (cache->fd == -1) return FcFalse; - if (!(dir = (char *)FcConfigNormalizeFontDir (config, (FcChar8 *)dir))) - return FcFalse; /* non-existing directory */ + if (config) + if (!(dir = (char *)FcConfigNormalizeFontDir (config, (FcChar8 *)dir))) + return FcFalse; /* non-existing directory */ for (d = cache->dirs; d; d = d->next) { -- 2.39.5