[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Fri Feb 5 16:02:41 UTC 2016


The branch master has been updated
       via  e51511ce497884ebf680714271ec96416e600622 (commit)
       via  c26e53698634d697fe01e28451c35220f2d3b7f9 (commit)
       via  541e9565bb5b860e9e0b5faeb5d474deeaef743b (commit)
      from  cc5a9ba485b988b036974cf682cda35180788446 (commit)


- Log -----------------------------------------------------------------
commit e51511ce497884ebf680714271ec96416e600622
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Fri Feb 5 14:50:06 2016 +0000

    enable leak checking for danetest
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit c26e53698634d697fe01e28451c35220f2d3b7f9
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Fri Feb 5 14:36:01 2016 +0000

    Fix return code in CRYPTO_mem_leaks_fp()
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 541e9565bb5b860e9e0b5faeb5d474deeaef743b
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Thu Jan 14 22:00:03 2016 +0000

    If memory debugging enabled return error on leaks.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

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

Summary of changes:
 apps/openssl.c           | 3 ++-
 crypto/mem_dbg.c         | 4 ++--
 test/clienthellotest.c   | 3 ++-
 test/danetest.c          | 4 +++-
 test/dsatest.c           | 3 ++-
 test/ecdhtest.c          | 3 ++-
 test/ecdsatest.c         | 3 ++-
 test/ectest.c            | 3 ++-
 test/enginetest.c        | 3 ++-
 test/evp_extra_test.c    | 3 ++-
 test/evp_test.c          | 3 ++-
 test/exptest.c           | 3 ++-
 test/jpaketest.c         | 3 ++-
 test/p5_crpt2_test.c     | 3 ++-
 test/rsa_test.c          | 3 ++-
 test/srptest.c           | 3 ++-
 test/ssltest.c           | 3 ++-
 test/verify_extra_test.c | 3 ++-
 18 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/apps/openssl.c b/apps/openssl.c
index 37f71a9..b8da88a 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -429,7 +429,8 @@ int main(int argc, char *argv[])
     BIO_free_all(bio_out);
     apps_shutdown();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        ret = 1;
 #endif
     BIO_free(bio_err);
     EXIT(ret);
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c
index 3568efd..0559044 100644
--- a/crypto/mem_dbg.c
+++ b/crypto/mem_dbg.c
@@ -694,8 +694,8 @@ int CRYPTO_mem_leaks_fp(FILE *fp)
     BIO *b;
     int ret;
 
-    if (mh == NULL)
-        return 0;
+    if (mh == NULL && amih == NULL)
+        return 1;
     /*
      * Need to turn off memory checking when allocated BIOs ... especially as
      * we're creating them at a time when we're trying to check we've not
diff --git a/test/clienthellotest.c b/test/clienthellotest.c
index 66fc27f..d9ae758 100644
--- a/test/clienthellotest.c
+++ b/test/clienthellotest.c
@@ -217,7 +217,8 @@ int main(int argc, char *argv[])
     EVP_cleanup();
     CRYPTO_cleanup_all_ex_data();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(err);
+    if (CRYPTO_mem_leaks(err) <= 0)
+        testresult = 0;
 #endif
     BIO_free(err);
 
diff --git a/test/danetest.c b/test/danetest.c
index 636f629..92a3b1b 100644
--- a/test/danetest.c
+++ b/test/danetest.c
@@ -474,6 +474,7 @@ int main(int argc, char *argv[])
     p = getenv("OPENSSL_DEBUG_MEMORY");
     if (p != NULL && strcmp(p, "on") == 0)
         CRYPTO_set_mem_debug(1);
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     f = fopen(tlsafile, "r");
     if (f == NULL) {
@@ -526,7 +527,8 @@ end:
     ERR_remove_thread_state(NULL);
     EVP_cleanup();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        ret = 1;
 #endif
     BIO_free(bio_err);
     EXIT(ret);
diff --git a/test/dsatest.c b/test/dsatest.c
index 426e443..f36b449 100644
--- a/test/dsatest.c
+++ b/test/dsatest.c
@@ -215,7 +215,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        ret = 0;
 #endif
     BIO_free(bio_err);
     bio_err = NULL;
diff --git a/test/ecdhtest.c b/test/ecdhtest.c
index 636be3e..16d8ced 100644
--- a/test/ecdhtest.c
+++ b/test/ecdhtest.c
@@ -516,7 +516,8 @@ int main(int argc, char *argv[])
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        ret = 1;
 #endif
     EXIT(ret);
 }
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index d098355..feb9f0a 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -545,7 +545,8 @@ int main(void)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(out);
+    if (CRYPTO_mem_leaks(out) <= 0)
+        ret = 1;
 #endif
     BIO_free(out);
     return ret;
diff --git a/test/ectest.c b/test/ectest.c
index 674e593..03dfed9 100644
--- a/test/ectest.c
+++ b/test/ectest.c
@@ -1687,7 +1687,8 @@ int main(int argc, char *argv[])
     ERR_free_strings();
     ERR_remove_thread_state(NULL);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        return 1;
 #endif
 
     return 0;
diff --git a/test/enginetest.c b/test/enginetest.c
index 886bf68..d8dcca9 100644
--- a/test/enginetest.c
+++ b/test/enginetest.c
@@ -249,7 +249,8 @@ int main(int argc, char *argv[])
     ERR_free_strings();
     ERR_remove_thread_state(NULL);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        to_return = 1;
 #endif
     return to_return;
 }
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 13dd262..53844ad 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -467,7 +467,8 @@ int main(void)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        return 1;
 #endif
 
     printf("PASS\n");
diff --git a/test/evp_test.c b/test/evp_test.c
index 6c9f4b8..ff2ee10 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -617,7 +617,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        return 1;
 #endif
     if (t.errors)
         return 1;
diff --git a/test/exptest.c b/test/exptest.c
index 0acdacc..5cd79e2 100644
--- a/test/exptest.c
+++ b/test/exptest.c
@@ -300,7 +300,8 @@ int main(int argc, char *argv[])
     BN_CTX_free(ctx);
     ERR_remove_thread_state(NULL);
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(out);
+    if (CRYPTO_mem_leaks(out) <= 0)
+        goto err;
 #endif
     BIO_free(out);
     printf("\n");
diff --git a/test/jpaketest.c b/test/jpaketest.c
index 7569f2e..7b59855 100644
--- a/test/jpaketest.c
+++ b/test/jpaketest.c
@@ -179,7 +179,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        return 1;
 #endif
 
     return 0;
diff --git a/test/p5_crpt2_test.c b/test/p5_crpt2_test.c
index 303906f..2c998ba 100644
--- a/test/p5_crpt2_test.c
+++ b/test/p5_crpt2_test.c
@@ -206,7 +206,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        return 1;
 # endif
     return 0;
 }
diff --git a/test/rsa_test.c b/test/rsa_test.c
index 0b707bf..9f1f3d6 100644
--- a/test/rsa_test.c
+++ b/test/rsa_test.c
@@ -328,7 +328,8 @@ int main(int argc, char *argv[])
     ERR_remove_thread_state(NULL);
 
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        err = 1;
 #endif
 
 # ifdef OPENSSL_SYS_NETWARE
diff --git a/test/srptest.c b/test/srptest.c
index f6555a6..442a610 100644
--- a/test/srptest.c
+++ b/test/srptest.c
@@ -147,7 +147,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        return 1;
 #endif
     BIO_free(bio_err);
 
diff --git a/test/ssltest.c b/test/ssltest.c
index 9cd2a53..f217a20 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -1865,7 +1865,8 @@ int main(int argc, char *argv[])
     ERR_remove_thread_state(NULL);
     EVP_cleanup();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks(bio_err);
+    if (CRYPTO_mem_leaks(bio_err) <= 0)
+        ret = 1;
 #endif
     BIO_free(bio_err);
     EXIT(ret);
diff --git a/test/verify_extra_test.c b/test/verify_extra_test.c
index 8432520..31c391e 100644
--- a/test/verify_extra_test.c
+++ b/test/verify_extra_test.c
@@ -208,7 +208,8 @@ int main(int argc, char **argv)
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
 #ifndef OPENSSL_NO_CRYPTO_MDEBUG
-    CRYPTO_mem_leaks_fp(stderr);
+    if (CRYPTO_mem_leaks_fp(stderr) <= 0)
+        return 1;
 #endif
 
     printf("PASS\n");


More information about the openssl-commits mailing list