]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcpat.c
Bug 44826 - <alias> must contain only a single <family>
[fontconfig.git] / src / fcpat.c
index 06b2f4ab6b9c1ee0388bc28357784a6d112fed1e..8f63659df673c2f204ec7bb5fe2ddeac6bff9dee 100644 (file)
@@ -5,9 +5,9 @@
  * documentation for any purpose is hereby granted without fee, provided that
  * the above copyright notice appear in all copies and that both that
  * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
+ * documentation, and that the name of the author(s) not be used in
  * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
+ * specific, written prior permission.  The authors make no
  * representations about the suitability of this software for any purpose.  It
  * is provided "as is" without express or implied warranty.
  *
@@ -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;