Bug 35587 - Add padding to make valgrind and glibc not hate each other
This commit is contained in:
parent
f0ee5761e1
commit
1c475d5c8c
13
src/fccfg.c
13
src/fccfg.c
|
@ -1689,10 +1689,19 @@ static FcChar8 *
|
||||||
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
||||||
{
|
{
|
||||||
FcChar8 *path;
|
FcChar8 *path;
|
||||||
|
int size;
|
||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
dir = (FcChar8 *) "";
|
dir = (FcChar8 *) "";
|
||||||
path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1);
|
|
||||||
|
size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1;
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
path = malloc (size);
|
||||||
if (!path)
|
if (!path)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1711,7 +1720,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
||||||
#endif
|
#endif
|
||||||
strcat ((char *) path, (char *) file);
|
strcat ((char *) path, (char *) file);
|
||||||
|
|
||||||
FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1);
|
FcMemAlloc (FC_MEM_STRING, size);
|
||||||
if (access ((char *) path, R_OK) == 0)
|
if (access ((char *) path, R_OK) == 0)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
|
|
10
src/fcpat.c
10
src/fcpat.c
|
@ -1057,9 +1057,13 @@ FcStrStaticName (const FcChar8 *name)
|
||||||
if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
|
if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
|
||||||
return (FcChar8 *) (b + 1);
|
return (FcChar8 *) (b + 1);
|
||||||
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
|
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
|
||||||
b = malloc (size + sizeof (int));
|
/*
|
||||||
/* workaround glibc bug which reads strlen in groups of 4 */
|
* workaround valgrind warning because glibc takes advantage of how it knows memory is
|
||||||
FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int));
|
* allocated to implement strlen by reading in groups of 4
|
||||||
|
*/
|
||||||
|
size = (size + 3) & ~3;
|
||||||
|
b = malloc (size);
|
||||||
|
FcMemAlloc (FC_MEM_STATICSTR, size);
|
||||||
if (!b)
|
if (!b)
|
||||||
return NULL;
|
return NULL;
|
||||||
b->next = 0;
|
b->next = 0;
|
||||||
|
|
Loading…
Reference in New Issue