diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-11-12 19:56:56 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-11-12 19:56:56 +0000 |
commit | c18e51ba5ec9569febd67313e4484b2a9c57eb0a (patch) | |
tree | e16f8e90f419b6764f33adaeb4b1100d0d28f61e /crypto/asn1/d2i_pu.c | |
parent | 773b63d6f9e20cbd90ead64d276068527eea4b24 (diff) | |
download | openssl-c18e51ba5ec9569febd67313e4484b2a9c57eb0a.zip openssl-c18e51ba5ec9569febd67313e4484b2a9c57eb0a.tar.gz openssl-c18e51ba5ec9569febd67313e4484b2a9c57eb0a.tar.bz2 |
PR: 2088
Submitted by: Aleksey Samsonov <s4ms0n0v@gmail.com>
Approved by: steve@openssl.org
Fix memory leak in d2i_PublicKey().
Diffstat (limited to 'crypto/asn1/d2i_pu.c')
-rw-r--r-- | crypto/asn1/d2i_pu.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/asn1/d2i_pu.c b/crypto/asn1/d2i_pu.c index 3694f51..c8f39ce 100644 --- a/crypto/asn1/d2i_pu.c +++ b/crypto/asn1/d2i_pu.c @@ -87,9 +87,13 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, } else ret= *a; - ret->save_type=type; - ret->type=EVP_PKEY_type(type); - switch (ret->type) + if (!EVP_PKEY_set_type(ret, type)) + { + ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); + goto err; + } + + switch (EVP_PKEY_id(ret)) { #ifndef OPENSSL_NO_RSA case EVP_PKEY_RSA: |