[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Mon Jun 19 13:06:47 UTC 2017
The branch master has been updated
via 3ac6d5ee5372b05aa90cc5c44efbde01bd669e9e (commit)
via af6de400b49c011600cfd557319d1142da6e5cbd (commit)
from 9b579777c5f84453940700fbd6f99abc09fe997e (commit)
- Log -----------------------------------------------------------------
commit 3ac6d5ee5372b05aa90cc5c44efbde01bd669e9e
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date: Mon Jun 19 13:33:41 2017 +0200
Fix the fall-out in 04-test_bioprint.t
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3712)
commit af6de400b49c011600cfd557319d1142da6e5cbd
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date: Mon Jun 19 11:18:44 2017 +0200
Fix the error handling in ERR_get_state:
- Ignoring the return code of ossl_init_thread_start created a memory leak.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3712)
-----------------------------------------------------------------------
Summary of changes:
crypto/err/err.c | 6 +++---
crypto/init.c | 12 ++++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/crypto/err/err.c b/crypto/err/err.c
index c5991fd..1c5d9e7 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -642,7 +642,7 @@ const char *ERR_reason_error_string(unsigned long e)
void err_delete_thread_state(void)
{
- ERR_STATE *state = ERR_get_state();
+ ERR_STATE *state = CRYPTO_THREAD_get_local(&err_thread_local);
if (state == NULL)
return;
@@ -682,14 +682,14 @@ ERR_STATE *ERR_get_state(void)
if (state == NULL)
return NULL;
- if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {
+ if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
+ || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
ERR_STATE_free(state);
return NULL;
}
/* Ignore failures from these */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
- ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);
}
return state;
diff --git a/crypto/init.c b/crypto/init.c
index 8f63b9a..b930b52 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;
More information about the openssl-commits
mailing list