pixman: Branch 'master'
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Sat Jul 10 18:07:53 PDT 2010
pixman/pixman-compiler.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
New commits:
commit 5c935473d8a193b3510f8605a6658ea6ac998fd1
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date: Wed Jun 30 02:31:10 2010 -0400
Fix memory leak in the pthreads thread local storage code
When a thread exits, we leak whatever is stored in thread local
variables, so install a destructor to free it.
diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
index f0f9d91..2b15cc3 100644
--- a/pixman/pixman-compiler.h
+++ b/pixman/pixman-compiler.h
@@ -72,9 +72,9 @@
/* TLS */
#if defined(PIXMAN_NO_TLS)
-# define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
+# define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
static type name
-# define PIXMAN_GET_THREAD_LOCAL(name) \
+# define PIXMAN_GET_THREAD_LOCAL(name) \
(&name)
#elif defined(TOOLCHAIN_SUPPORTS__THREAD)
@@ -165,9 +165,16 @@ extern __stdcall int ReleaseMutex (void *);
static pthread_key_t tls_ ## name ## _key; \
\
static void \
+ tls_ ## name ## _destroy_value (void *value) \
+ { \
+ free (value); \
+ } \
+ \
+ static void \
tls_ ## name ## _make_key (void) \
{ \
- pthread_key_create (&tls_ ## name ## _key, NULL); \
+ pthread_key_create (&tls_ ## name ## _key, \
+ tls_ ## name ## _destroy_value); \
} \
\
static type * \
More information about the xorg-commit
mailing list