diff options
author | Stef Walter <stefw@gnome.org> | 2012-02-27 20:27:09 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2012-04-02 07:26:05 +0200 |
commit | c43038d82edcfd878ff66e3aa7fe247f53876f9b (patch) | |
tree | 89b29332b8082d0156f644f78f178422a6a48a76 /p11-kit | |
parent | ff9926b8dcead91e7fc6d08d0ca1d2d8cc982308 (diff) |
Add more p11-kit cleanup to fix valgrind leak reports
* per-thread memory isn't actually a real memory leak, but was
still reachable after exit, so clean this up.
Diffstat (limited to 'p11-kit')
-rw-r--r-- | p11-kit/util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/p11-kit/util.c b/p11-kit/util.c index fd7708a..97a113b 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -275,19 +275,30 @@ _p11_library_get_thread_local (void) return local; } +#ifdef __GNUC__ +__attribute__((constructor)) +#endif void _p11_library_init (void) { _p11_debug_init (); + _p11_debug ("initializing library"); _p11_mutex_init (&_p11_mutex); pthread_key_create (&thread_local, free); } +#ifdef __GNUC__ +__attribute__((destructor)) +#endif void _p11_library_uninit (void) { uninit_common (); + /* Some cleanup to pacify valgrind */ + free (pthread_getspecific (thread_local)); + pthread_setspecific (thread_local, NULL); + pthread_key_delete (thread_local); _p11_mutex_uninit (&_p11_mutex); } |