[openssl-commits] [openssl] master update

Kurt Roeckx kurt at openssl.org
Sat Apr 11 18:34:35 UTC 2015


The branch master has been updated
       via  a38537721dfdd853c40b4b4d99b57950075b0178 (commit)
       via  8ec5c5dd361343d9017eff8547b19e86e4944ebc (commit)
       via  f49baeff50d0be9c8d86aed6fb4a08841aa3da41 (commit)
      from  62adbcee392ba1061bf213174e8c59728e00860e (commit)


- Log -----------------------------------------------------------------
commit a38537721dfdd853c40b4b4d99b57950075b0178
Author: Rich Salz <rsalz at openssl.org>
Date:   Sat Apr 11 16:53:27 2015 +0200

    Fix memory leak
    
    It should have freed them when != NULL, not when == NULL.
    
    Reviewed-by: Kurt Roeckx <kurt at roeckx.be>
    Reviewed-by: Viktor Dukhovni <openssl-users at dukhovni.org>

commit 8ec5c5dd361343d9017eff8547b19e86e4944ebc
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sat Apr 11 16:39:13 2015 +0200

    do_dirname: Don't change gen on failures
    
    It would set gen->d.dirn to a freed pointer in case X509V3_NAME_from_section
    failed.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit f49baeff50d0be9c8d86aed6fb4a08841aa3da41
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sat Apr 11 17:08:38 2015 +0200

    X509_VERIFY_PARAM_free: Check param for NULL
    
    Reviewed-by: Viktor Dukhovni <openssl-users at dukhovni.org>

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

Summary of changes:
 crypto/ec/ecp_smpl.c   |  9 +++------
 crypto/x509/x509_vpm.c |  2 ++
 crypto/x509v3/v3_alt.c | 18 ++++++++++--------
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c
index ee0c468..2d42d34 100644
--- a/crypto/ec/ecp_smpl.c
+++ b/crypto/ec/ecp_smpl.c
@@ -133,12 +133,9 @@ int ec_GFp_simple_group_init(EC_GROUP *group)
     group->a = BN_new();
     group->b = BN_new();
     if (!group->field || !group->a || !group->b) {
-        if (!group->field)
-            BN_free(group->field);
-        if (!group->a)
-            BN_free(group->a);
-        if (!group->b)
-            BN_free(group->b);
+        BN_free(group->field);
+        BN_free(group->a);
+        BN_free(group->b);
         return 0;
     }
     group->a_is_minus3 = 0;
diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c
index 8194cfa..2c30ff4 100644
--- a/crypto/x509/x509_vpm.c
+++ b/crypto/x509/x509_vpm.c
@@ -189,6 +189,8 @@ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
 
 void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
 {
+    if (param == NULL)
+        return;
     x509_verify_param_zero(param);
     OPENSSL_free(param->id);
     OPENSSL_free(param);
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index 50cb6b2..d5ceb44 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -586,24 +586,26 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
 
 static int do_dirname(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
 {
-    int ret;
-    STACK_OF(CONF_VALUE) *sk;
-    X509_NAME *nm;
+    int ret = 0;
+    STACK_OF(CONF_VALUE) *sk = NULL;
+    X509_NAME *nm = NULL;
     if (!(nm = X509_NAME_new()))
-        return 0;
+        goto err;
     sk = X509V3_get_section(ctx, value);
     if (!sk) {
         X509V3err(X509V3_F_DO_DIRNAME, X509V3_R_SECTION_NOT_FOUND);
         ERR_add_error_data(2, "section=", value);
-        X509_NAME_free(nm);
-        return 0;
+        goto err;
     }
     /* FIXME: should allow other character types... */
     ret = X509V3_NAME_from_section(nm, sk, MBSTRING_ASC);
     if (!ret)
-        X509_NAME_free(nm);
+        goto err;
     gen->d.dirn = nm;
-    X509V3_section_free(ctx, sk);
 
+err:
+    if (ret == 0)
+        X509_NAME_free(nm);
+    X509V3_section_free(ctx, sk);
     return ret;
 }


More information about the openssl-commits mailing list