diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-06-19 13:33:41 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-06-19 14:56:50 +0200 |
commit | 3ac6d5ee5372b05aa90cc5c44efbde01bd669e9e (patch) | |
tree | ed3d53ba44b3be25ba03a6c80a350cd398eb7494 /crypto/init.c | |
parent | Fix the error handling in ERR_get_state: (diff) | |
download | openssl-3ac6d5ee5372b05aa90cc5c44efbde01bd669e9e.tar.xz openssl-3ac6d5ee5372b05aa90cc5c44efbde01bd669e9e.zip |
Fix the fall-out in 04-test_bioprint.t
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3712)
Diffstat (limited to 'crypto/init.c')
-rw-r--r-- | crypto/init.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/init.c b/crypto/init.c index 8f63b9aa99..b930b52b2f 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -43,7 +43,10 @@ static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) if (local == NULL && alloc) { local = OPENSSL_zalloc(sizeof *local); - CRYPTO_THREAD_set_local(&threadstopkey, local); + if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) { + OPENSSL_free(local); + return NULL; + } } if (!alloc) { CRYPTO_THREAD_set_local(&threadstopkey, NULL); @@ -359,7 +362,12 @@ void OPENSSL_thread_stop(void) int ossl_init_thread_start(uint64_t opts) { - struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); + struct thread_local_inits_st *locals; + + if (!OPENSSL_init_crypto(0, NULL)) + return 0; + + locals = ossl_init_get_thread_local(1); if (locals == NULL) return 0; |