aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/src')
-rwxr-xr-xfontconfig/src/fccache.c7
-rw-r--r--fontconfig/src/fccfg.c4
-rw-r--r--fontconfig/src/fcdefault.c28
-rw-r--r--fontconfig/src/fcfreetype.c3
4 files changed, 29 insertions, 13 deletions
diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c
index c37cbe148..d894fc2b6 100755
--- a/fontconfig/src/fccache.c
+++ b/fontconfig/src/fccache.c
@@ -449,6 +449,9 @@ FcCacheFindByAddrUnlocked (void *object)
FcCacheSkip **next = fcCacheChains;
FcCacheSkip *s;
+ if (!object)
+ return NULL;
+
/*
* Walk chain pointers one level at a time
*/
@@ -556,7 +559,7 @@ FcCacheObjectDereference (void *object)
skip = FcCacheFindByAddrUnlocked (object);
if (skip)
{
- if (FcRefDec (&skip->ref) <= 1)
+ if (FcRefDec (&skip->ref) == 1)
FcDirCacheDisposeUnlocked (skip->cache);
}
unlock_cache ();
@@ -1109,6 +1112,7 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose)
cache_dir, ent->d_name, target_dir);
remove = FcTrue;
}
+ FcDirCacheUnload (cache);
}
if (remove)
{
@@ -1118,7 +1122,6 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose)
ret = FcFalse;
}
}
- FcDirCacheUnload (cache);
FcStrFree (file_name);
}
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index 3e9fdaba4..12d7e1a97 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -337,8 +337,8 @@ FcConfigAddCache (FcConfig *config, FcCache *cache,
if (!FcConfigAcceptFont (config, font))
continue;
- nref++;
- FcFontSetAdd (config->fonts[set], font);
+ if (FcFontSetAdd (config->fonts[set], font))
+ nref++;
}
FcDirCacheReference (cache, nref);
}
diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c
index aa47840d1..b1bd9cc1f 100644
--- a/fontconfig/src/fcdefault.c
+++ b/fontconfig/src/fcdefault.c
@@ -23,6 +23,7 @@
*/
#include "fcint.h"
+#include <limits.h>
#include <string.h>
/* MT-safe */
@@ -139,27 +140,38 @@ retry:
prgname = FcStrdup (p);
}
+#elif defined (HAVE_GETPROGNAME)
+ const char *q = getprogname ();
+ if (q)
+ prgname = FcStrdup (q);
+ else
+ prgname = FcStrdup ("");
#else
- char buf[8192];
+ char buf[PATH_MAX + 1];
unsigned int len;
+ char *p = NULL;
len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
if (len > 0)
{
- char *p;
+ buf[len] = '\0';
+ p = buf;
+ }
- p = strrchr (buf, '/');
- if (p)
- p++;
+ if (p)
+ {
+ char *r = strrchr (p, '/');
+ if (r)
+ r++;
else
- p = buf;
+ r = p;
- prgname = FcStrdup (p);
+ prgname = FcStrdup (r);
}
-#endif
if (!prgname)
prgname = FcStrdup ("");
+#endif
if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
free (prgname);
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index e88c37770..cb502438f 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -1706,7 +1706,8 @@ FcFreeTypeQueryFace (const FT_Face face,
{
const char *font_format = FT_Get_X11_Font_Format (face);
if (font_format)
- FcPatternAddString (pat, FC_FONTFORMAT, (FcChar8 *) font_format);
+ if (!FcPatternAddString (pat, FC_FONTFORMAT, (FcChar8 *) font_format))
+ goto bail2;
}
#endif