From: Martin Mares Date: Mon, 18 Dec 2006 10:52:33 +0000 (+0100) Subject: Free thread context structure on thread termination. X-Git-Tag: holmes-import~507^2~3^2~2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;ds=sidebyside;h=7469a39867d251cf81e03a25922d29a49af3fee6;p=libucw.git Free thread context structure on thread termination. --- diff --git a/lib/threads.c b/lib/threads.c index 26033e54..f45c8e38 100644 --- a/lib/threads.c +++ b/lib/threads.c @@ -17,10 +17,16 @@ static pthread_key_t ucwlib_context_key; static pthread_mutex_t ucwlib_master_mutex; +static void +ucwlib_free_thread_context(void *p) +{ + xfree(p); +} + static void CONSTRUCTOR ucwlib_threads_init(void) { - if (pthread_key_create(&ucwlib_context_key, NULL) < 0) + if (pthread_key_create(&ucwlib_context_key, ucwlib_free_thread_context) < 0) die("Cannot create pthread_key: %m"); pthread_mutex_init(&ucwlib_master_mutex, NULL); }