]> git.wh0rd.org - fontconfig.git/commitdiff
Add padding to make valgrind and glibc not hate each other when calling
authorPatrick Lam <plam@MIT.EDU>
Thu, 6 Oct 2005 20:45:25 +0000 (20:45 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 6 Oct 2005 20:45:25 +0000 (20:45 +0000)
    strlen().

ChangeLog
src/fcname.c
src/fcpat.c

index 244547be617257cccebf109bc97da649404c9b84..ef860a8981a650dffefbaeb443d3dd2c091d9496 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-06  Patrick Lam  <plam@mit.edu>
+
+        * 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  <simos74@gmx.net>
        reviewed by: plam & keithp
 
index a21e99523ce1331d21a88b9db29a7f26aa364061..97efcb22a380d342583dcb52ccb073a8adac3f6d 100644 (file)
@@ -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;
index 5bb635fff7648488ab89444480f70ecb05c90ba4..0714dc76306f9bc2546d100d9c15ec22f01f1c77 100644 (file)
@@ -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;