From: Patrick Lam Date: Thu, 6 Oct 2005 20:45:25 +0000 (+0000) Subject: Add padding to make valgrind and glibc not hate each other when calling X-Git-Tag: fc-2_3_92~25 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=23787a8f1b7a23c82f479b0e6906928b9920b9cc;p=fontconfig.git Add padding to make valgrind and glibc not hate each other when calling strlen(). --- diff --git a/ChangeLog b/ChangeLog index 244547b..ef860a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-10-06 Patrick Lam + + * src/fcname.c (FcObjectToPtr): + * src/fcpat.c (FcStrStaticName): + + Add padding to make valgrind and glibc not hate each other + when calling strlen(). + 2005-10-05 Simos Xenitellis reviewed by: plam & keithp diff --git a/src/fcname.c b/src/fcname.c index a21e995..97efcb2 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -263,8 +263,9 @@ FcObjectToPtr (const char * name) if (b->hash == hash && !strcmp (name, (char *) (b + 1))) return b->id; size = sizeof (struct objectBucket) + strlen (name) + 1; - b = malloc (size); - FcMemAlloc (FC_MEM_STATICSTR, size); + /* workaround glibc bug which reads strlen in groups of 4 */ + b = malloc (size + sizeof (int)); + FcMemAlloc (FC_MEM_STATICSTR, size + sizeof(int)); if (!b) return 0; b->next = 0; diff --git a/src/fcpat.c b/src/fcpat.c index 5bb635f..0714dc7 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -1298,8 +1298,9 @@ FcStrStaticName (const FcChar8 *name) if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1))) return (FcChar8 *) (b + 1); size = sizeof (struct objectBucket) + strlen ((char *)name) + 1; - b = malloc (size); - FcMemAlloc (FC_MEM_STATICSTR, size); + b = malloc (size + sizeof (int)); + /* workaround glibc bug which reads strlen in groups of 4 */ + FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int)); if (!b) return NULL; b->next = 0;