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:28:29 +0000
commit4fd35d83412946d19da05d4c89f6c2002d5c2e82 (patch)
tree2386ba39734fa7434b4adb9fe955c1bacbd1a062 /crypto
parent07109409daa674e4e766523a1dc51edb06299e03 (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) (cherry picked from commit e0670973d5c0b837eb5a9f1670e47107f466fbc7)
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 d089af7a28..2c41c6e7a9 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -342,8 +342,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;
}