[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Mon Nov 21 21:38:09 UTC 2016


The branch master has been updated
       via  024d681e69cc1ea7177a7eae9aeb1947412950ed (commit)
      from  beacb0f0c1ae7b0542fe053b95307f515b578eb7 (commit)


- Log -----------------------------------------------------------------
commit 024d681e69cc1ea7177a7eae9aeb1947412950ed
Author: Todd Short <tshort at akamai.com>
Date:   Thu Nov 17 11:56:47 2016 -0500

    Skipping tests in evp_test leaks memory
    
    When configured with "no-mdc2 enable-crypto-mdebug" the evp_test
    will leak memory due to skipped tests, and error out.
    
    Also fix a skip condition
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1968)

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

Summary of changes:
 test/evp_test.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/test/evp_test.c b/test/evp_test.c
index 0c352d6..907e083 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -351,25 +351,28 @@ static int setup_test(struct evp_test *t, const struct evp_test_method *tmeth)
     if (t->meth) {
         t->ntests++;
         if (t->skip) {
-            t->meth = tmeth;
             t->nskip++;
-            return 1;
-        }
-        t->err = NULL;
-        if (t->meth->run_test(t) != 1) {
-            fprintf(stderr, "%s test error line %d\n",
-                    t->meth->name, t->start_line);
-            return 0;
-        }
-        if (!check_test_error(t)) {
-            if (t->err)
-                ERR_print_errors_fp(stderr);
-            t->errors++;
+        } else {
+            /* run the test */
+            t->err = NULL;
+            if (t->meth->run_test(t) != 1) {
+                fprintf(stderr, "%s test error line %d\n",
+                        t->meth->name, t->start_line);
+                return 0;
+            }
+            if (!check_test_error(t)) {
+                if (t->err)
+                    ERR_print_errors_fp(stderr);
+                t->errors++;
+            }
         }
+        /* clean it up */
         ERR_clear_error();
-        t->meth->cleanup(t);
-        OPENSSL_free(t->data);
-        t->data = NULL;
+        if (t->data != NULL) {
+            t->meth->cleanup(t);
+            OPENSSL_free(t->data);
+            t->data = NULL;
+        }
         OPENSSL_free(t->expected_err);
         t->expected_err = NULL;
         free_expected(t);
@@ -1212,9 +1215,7 @@ static int pkey_test_init(struct evp_test *t, const char *name,
         rv = find_key(&pkey, name, t->public);
     if (!rv)
         rv = find_key(&pkey, name, t->private);
-    if (!rv)
-        return 0;
-    if (!pkey) {
+    if (!rv || pkey == NULL) {
         t->skip = 1;
         return 1;
     }


More information about the openssl-commits mailing list