diff options
author | Adam Langley <agl@chromium.org> | 2014-06-20 23:00:00 +0400 |
---|---|---|
committer | Adam Langley <agl@chromium.org> | 2014-06-21 00:17:40 +0400 |
commit | cdf96e588654cb686add87fee2429cf687f821b2 (patch) | |
tree | bcd0d8f9cf52ff6b2a4f79b930320f2e47321bc0 /crypto | |
parent | eceb33d3afe6b36061df9c94fb28e0e08f15ea94 (diff) |
Double free in i2o_ECPublicKey
PR: 3338
(Imported from upstream's e34af3ec2b1230a8a523d383f7de505f7cbd381d)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ec/ec_asn1.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index 2aa319b1..35fff744 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -544,8 +544,10 @@ int i2o_ECPublicKey(const EC_KEY *key, uint8_t **outp) { if (!EC_POINT_point2oct(key->group, key->pub_key, key->conv_form, *outp, buf_len, NULL)) { OPENSSL_PUT_ERROR(EC, i2o_ECPublicKey, ERR_R_EC_LIB); - OPENSSL_free(*outp); - *outp = NULL; + if (new_buffer) { + OPENSSL_free(*outp); + *outp = NULL; + } return 0; } |