summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorYuchi <yt8mn@virginia.edu>2017-02-05 19:33:47 -0500
committerMatt Caswell <matt@openssl.org>2017-02-14 10:19:50 +0000
commite0670973d5c0b837eb5a9f1670e47107f466fbc7 (patch)
tree1e4d59ce584d3c4c508bd790c5f2e8337087f3e5 /crypto
parentb84460ad3a3e4fcb22efaa0a8365b826f4264ecf (diff)
mem leak on error path and error propagation fix
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2559)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ec/ec_ameth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index 66437e0da5..fa5bd0318c 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -254,8 +254,10 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
}
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0,
- ptype, pval, ep, eplen))
+ ptype, pval, ep, eplen)) {
+ OPENSSL_free(ep);
return 0;
+ }
return 1;
}