Fix uninitialized cache when pthreads are used
authorSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 7 Apr 2010 05:39:14 +0000 (01:39 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 14 Apr 2010 02:41:47 +0000 (22:41 -0400)
The thread local cache is allocated with malloc(), but we rely on it
being initialized to zero, so allocate it with calloc() instead.

pixman/pixman-compiler.h

index a4e3f88..cdac0d8 100644 (file)
     static type *                                                      \
     tls_ ## name ## _alloc (key)                                       \
     {                                                                  \
-       type *value = malloc (sizeof (type));                           \
+       type *value = calloc (1, sizeof (type));                        \
        if (value)                                                      \
            pthread_setspecific (key, value);                           \
        return value;                                                   \