[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Tue Jun 13 17:50:45 UTC 2017


The branch master has been updated
       via  188a9bd950837c70661aa6849894e4e02d129031 (commit)
      from  150d0478a41e592e1aced6b392db4195eb6191f9 (commit)


- Log -----------------------------------------------------------------
commit 188a9bd950837c70661aa6849894e4e02d129031
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Tue Jun 13 07:22:50 2017 +0200

    Fix a memleak in ec_copy_parameters.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3666)

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

Summary of changes:
 crypto/ec/ec_ameth.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index fa5bd03..b66adf2 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -298,17 +298,21 @@ static int ec_missing_parameters(const EVP_PKEY *pkey)
 static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
 {
     EC_GROUP *group = EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec));
+
     if (group == NULL)
         return 0;
     if (to->pkey.ec == NULL) {
         to->pkey.ec = EC_KEY_new();
         if (to->pkey.ec == NULL)
-            return 0;
+            goto err;
     }
     if (EC_KEY_set_group(to->pkey.ec, group) == 0)
-        return 0;
+        goto err;
     EC_GROUP_free(group);
     return 1;
+ err:
+    EC_GROUP_free(group);
+    return 0;
 }
 
 static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)


More information about the openssl-commits mailing list