fix memory leaks
authorMiroslav Franc <mfranc@gmx.com>
Thu, 14 Jul 2016 15:14:08 +0000 (17:14 +0200)
committerRich Salz <rsalz@openssl.org>
Sat, 16 Jul 2016 16:32:34 +0000 (12:32 -0400)
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1313)

crypto/ec/ecp_mont.c
ssl/ssl_rsa.c

index a9c6040937c0a257e716ea080c87728fb9232e48..994cc1d0fff5f79c59c771f6fd3b43132dca6952 100644 (file)
@@ -178,6 +178,7 @@ int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
     }
 
  err:
+    BN_free(one);
     BN_CTX_free(new_ctx);
     BN_MONT_CTX_free(mont);
     return ret;
index aad65ead89200e045e9265f02cb36a7d42bd954a..bb4e872ab47795f422fe151ad02b4cd9a9065747 100644 (file)
@@ -110,6 +110,7 @@ int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa)
     RSA_up_ref(rsa);
     if (EVP_PKEY_assign_RSA(pkey, rsa) <= 0) {
         RSA_free(rsa);
+        EVP_PKEY_free(pkey);
         return 0;
     }
 
@@ -452,6 +453,7 @@ int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
     RSA_up_ref(rsa);
     if (EVP_PKEY_assign_RSA(pkey, rsa) <= 0) {
         RSA_free(rsa);
+        EVP_PKEY_free(pkey);
         return 0;
     }