From: Richard Levitte Date: Thu, 26 Feb 2004 22:07:47 +0000 (+0000) Subject: Make sure the given EVP_PKEY is updated in the PEM_STRING_PKCS8INF case also. X-Git-Tag: OpenSSL_0_9_7d~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ee121033dc1a4331e54d90898089b654f16ffec6;p=oweals%2Fopenssl.git Make sure the given EVP_PKEY is updated in the PEM_STRING_PKCS8INF case also. PR: 833 --- diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c index d96ecf6940..f77c949e87 100644 --- a/crypto/pem/pem_pkey.c +++ b/crypto/pem/pem_pkey.c @@ -87,6 +87,10 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); if(!p8inf) goto p8err; ret = EVP_PKCS82PKEY(p8inf); + if(x) { + if(*x) EVP_PKEY_free((EVP_PKEY *)*x); + *x = ret; + } PKCS8_PRIV_KEY_INFO_free(p8inf); } else if (strcmp(nm,PEM_STRING_PKCS8) == 0) { PKCS8_PRIV_KEY_INFO *p8inf;