Browse code

libclamav: make sure TLS key is initializer (bb #2588)

Thanks to Cameron Brown for the detailed analysis of the bug.

Török Edvin authored on 2011/04/15 03:29:05
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Apr 14 21:29:36 EEST 2011 (edwin)
2
+-------------------------------------
3
+ * libclamav/others.c: make sure TLS key is initializer (bb #2588).
4
+    Thanks to Cameron Brown for the detailed analysis of the bug.
5
+
1 6
 Thu Apr 14 13:19:38 EEST 2011 (edwin)
2 7
 -------------------------------------
3 8
  * configure: check for enable_extended_FILE_stdio (bb #2542)
... ...
@@ -96,6 +96,7 @@ void cli_logg_unsetup(void)
96 96
 
97 97
 static inline void *cli_getctx(void)
98 98
 {
99
+    pthread_once(&cli_ctx_tls_key_once, cli_ctx_tls_key_alloc);
99 100
     cli_ctx *ctx = pthread_getspecific(cli_ctx_tls_key);
100 101
     return ctx ? ctx->cb_ctx : NULL;
101 102
 }