X-Git-Url: https://git.wh0rd.org/?p=fontconfig.git;a=blobdiff_plain;f=src%2Ffcpat.c;h=8f63659df673c2f204ec7bb5fe2ddeac6bff9dee;hp=be01a4fd25a46906de26916b0b2b37892eb04b19;hb=1c475d5c8cb265ac939d6b9e097666e300162511;hpb=f0ee5761e1ab63d848f980a767dd8475986f1342 diff --git a/src/fcpat.c b/src/fcpat.c index be01a4f..8f63659 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -1057,9 +1057,13 @@ 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 + sizeof (int)); - /* workaround glibc bug which reads strlen in groups of 4 */ - FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int)); + /* + * 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; + b = malloc (size); + FcMemAlloc (FC_MEM_STATICSTR, size); if (!b) return NULL; b->next = 0;