[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Rich Salz rsalz at openssl.org
Mon Jun 19 13:25:41 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  77b072504ec464eac5e0f9aab19cadb9c4e311d1 (commit)
      from  0e0a9ae30baff1c886200f4ee682f893ec8eda30 (commit)


- Log -----------------------------------------------------------------
commit 77b072504ec464eac5e0f9aab19cadb9c4e311d1
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)
    (cherry picked from commit af6de400b49c011600cfd557319d1142da6e5cbd)

-----------------------------------------------------------------------

Summary of changes:
 crypto/err/err.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/err/err.c b/crypto/err/err.c
index 8b47085..57b9576 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -625,7 +625,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;
 
@@ -665,14 +665,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;


More information about the openssl-commits mailing list