[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Thu Apr 28 21:38:44 UTC 2016


The branch master has been updated
       via  a14a740dbecf112ed9de53fb90f34f2af871cda9 (commit)
      from  2bbf0baa9565cce937d85592f12d1279871dfaf6 (commit)


- Log -----------------------------------------------------------------
commit a14a740dbecf112ed9de53fb90f34f2af871cda9
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Thu Apr 28 20:13:44 2016 +0200

    BIO_free should call method->destroy before free'ing member fields
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1007)

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

Summary of changes:
 crypto/bio/bio_lib.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 6ddc19f..8f68485 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -98,6 +98,7 @@ int BIO_set(BIO *bio, const BIO_METHOD *method)
 
     bio->lock = CRYPTO_THREAD_lock_new();
     if (bio->lock == NULL) {
+        BIOerr(BIO_F_BIO_SET, ERR_R_MALLOC_FAILURE);
         CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
         return 0;
     }
@@ -131,13 +132,13 @@ int BIO_free(BIO *a)
         ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
         return i;
 
+    if ((a->method != NULL) && (a->method->destroy != NULL))
+        a->method->destroy(a);
+
     CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
 
     CRYPTO_THREAD_lock_free(a->lock);
 
-    if ((a->method != NULL) && (a->method->destroy != NULL))
-        a->method->destroy(a);
-
     OPENSSL_free(a);
 
     return 1;


More information about the openssl-commits mailing list