}
static struct thread_local_inits_st *local = NULL;
-void *ossl_init_get_thread_local(int alloc)
+static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
{
+ static struct thread_local_inits_st *tmp;
+
+ tmp = local;
+
if (local == NULL && alloc)
- local = OPENSSL_zalloc(sizeof(*local));
- return local;
+ tmp = local = OPENSSL_zalloc(sizeof(*local));
+
+ if (!alloc)
+ local = NULL;
+
+ return tmp;
}
#elif defined(OPENSSL_SYS_WINDOWS)
}
}
-void *ossl_init_get_thread_local(int alloc)
+static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
{
struct thread_local_inits_st *local = TlsGetValue(threadstopkey);
local = OPENSSL_zalloc(sizeof *local);
TlsSetValue(threadstopkey, local);
}
+ if (!alloc) {
+ TlsSetValue(threadstopkey, NULL);
+ }
return local;
}
{
}
-void *ossl_init_get_thread_local(int alloc)
+static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
{
struct thread_local_inits_st *local = pthread_getspecific(threadstopkey);
local = OPENSSL_zalloc(sizeof *local);
pthread_setspecific(threadstopkey, local);
}
+ if (!alloc) {
+ pthread_setspecific(threadstopkey, NULL);
+ }
return local;
}