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 244547b..ef860a8 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 a21e995..97efcb2 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 5bb635f..0714dc7 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;