aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fccfg.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-29 07:22:59 +0000
committermarha <marha@users.sourceforge.net>2011-03-29 07:22:59 +0000
commit2ed8e0e263e27934ba97c00d4820dab5ec08b548 (patch)
tree8ec0340f8100b6824afc3592a586b97d669f0256 /fontconfig/src/fccfg.c
parent87027d4d788c04d3f721b27eb718207bbf30f61c (diff)
parent24abc56b37a3ec32a03b7eafccd96607ae13ea89 (diff)
downloadvcxsrv-2ed8e0e263e27934ba97c00d4820dab5ec08b548.tar.gz
vcxsrv-2ed8e0e263e27934ba97c00d4820dab5ec08b548.tar.bz2
vcxsrv-2ed8e0e263e27934ba97c00d4820dab5ec08b548.zip
svn merge ^/branches/released .
Diffstat (limited to 'fontconfig/src/fccfg.c')
-rw-r--r--fontconfig/src/fccfg.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index d6300515e..d948ab8d5 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -1689,10 +1689,19 @@ static FcChar8 *
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
{
FcChar8 *path;
+ int size;
if (!dir)
dir = (FcChar8 *) "";
- path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1);
+
+ size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1;
+ /*
+ * workaround valgrind warning because glibc takes advantage of how it knows memory is
+ * allocated to implement strlen by reading in groups of 4
+ */
+ size = (size + 3) & ~3;
+
+ path = malloc (size);
if (!path)
return 0;
@@ -1711,7 +1720,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
#endif
strcat ((char *) path, (char *) file);
- FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1);
+ FcMemAlloc (FC_MEM_STRING, size);
if (access ((char *) path, R_OK) == 0)
return path;