aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fccfg.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-29 06:44:20 +0000
committermarha <marha@users.sourceforge.net>2011-03-29 06:44:20 +0000
commit24abc56b37a3ec32a03b7eafccd96607ae13ea89 (patch)
treee3f598bb372c5189c86acbd7f87ca6ee897d114e /fontconfig/src/fccfg.c
parent0b9b391c5a7acb31e5d8061169649043a38d6d0e (diff)
downloadvcxsrv-24abc56b37a3ec32a03b7eafccd96607ae13ea89.tar.gz
vcxsrv-24abc56b37a3ec32a03b7eafccd96607ae13ea89.tar.bz2
vcxsrv-24abc56b37a3ec32a03b7eafccd96607ae13ea89.zip
xserver fontconfig mesa git update 29 Mar 2011
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 4beb7d236..09c59919d 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;