From 23787a8f1b7a23c82f479b0e6906928b9920b9cc Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Thu, 6 Oct 2005 20:45:25 +0000 Subject: [PATCH] Add padding to make valgrind and glibc not hate each other when calling strlen(). --- ChangeLog | 8 ++++++++ src/fcname.c | 5 +++-- src/fcpat.c | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) 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; -- 2.39.5