[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Dr. Stephen Henson steve at openssl.org
Mon Feb 9 13:02:30 UTC 2015


The branch OpenSSL_1_0_2-stable has been updated
       via  ba25221226f0c9b033d8ff8a2a2bde8b359c6426 (commit)
      from  506805e708604efb9448d26e9e94c14cb2d9ccd9 (commit)


- Log -----------------------------------------------------------------
commit ba25221226f0c9b033d8ff8a2a2bde8b359c6426
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Sun Feb 8 13:14:05 2015 +0000

    Fix memory leak reporting.
    
    Free up bio_err after memory leak data has been printed to it.
    
    In int_free_ex_data if ex_data is NULL there is nothing to free up
    so return immediately and don't reallocate it.
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    
    (cherry picked from commit 9c7a780bbebc1b6d87dc38a6aa3339033911a8bb)

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

Summary of changes:
 apps/openssl.c   |    8 ++++----
 crypto/ex_data.c |    2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/apps/openssl.c b/apps/openssl.c
index 112ed7e..6873145 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -428,10 +428,6 @@ int main(int Argc, char *ARGV[])
     if (arg.data != NULL)
         OPENSSL_free(arg.data);
 
-    if (bio_err != NULL) {
-        BIO_free(bio_err);
-        bio_err = NULL;
-    }
 #if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
     /* Free any duplicate Argv[] storage. */
     if (free_Argv) {
@@ -440,6 +436,10 @@ int main(int Argc, char *ARGV[])
 #endif
     apps_shutdown();
     CRYPTO_mem_leaks(bio_err);
+    if (bio_err != NULL) {
+        BIO_free(bio_err);
+        bio_err = NULL;
+    }
 
     OPENSSL_EXIT(ret);
 }
diff --git a/crypto/ex_data.c b/crypto/ex_data.c
index 5a3546a..f96a517 100644
--- a/crypto/ex_data.c
+++ b/crypto/ex_data.c
@@ -500,6 +500,8 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
     EX_CLASS_ITEM *item;
     void *ptr;
     CRYPTO_EX_DATA_FUNCS **storage = NULL;
+    if (ex_data == NULL)
+        return;
     if ((item = def_get_class(class_index)) == NULL)
         return;
     CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);


More information about the openssl-commits mailing list