Skip to content

Commit 9c3b08b

Browse files
committed
use local variable instead of global
1 parent c72dedf commit 9c3b08b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

thread_setup_unix.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ static pthread_mutex_t *mutex_buf = NULL;
99

1010
static pthread_key_t destructor_key;
1111

12-
/* An unused value whose address is passed to pthread_setspecific. It only needs to have a valid size. See https://github.com/golang-fips/openssl/pull/162. */
13-
static char stub;
14-
1512
/* Used by unit tests. */
1613
volatile unsigned int go_openssl_threads_cleaned_up = 0;
1714

@@ -31,7 +28,10 @@ static void thread_id(GO_CRYPTO_THREADID_PTR tid)
3128
// per-thread error state, so this function is guaranteed to be executed at
3229
// least once on any thread with associated error state. The thread-local
3330
// variable needs to be set to a non-NULL value so that the destructor will
34-
// be called when the thread exits. The actual value does not matter.
31+
// be called when the thread exits.
32+
// The actual value does not matter, but should be a pointer with a valid size.
33+
// See https://github.com/golang-fips/openssl/pull/162
34+
static char stub;
3535
(void) pthread_setspecific(destructor_key, &stub);
3636
}
3737

0 commit comments

Comments
 (0)