Nicolas Roumiantzeff wrote:
> 
> >What you normally do is this...
> >EVP_PKEY *key;
> >/* X509 *cert from somewhere */
> >key = X509_get_pubkey(x509);
> >/* various operations */
> >X509_free(x509);
> >EVP_PKEY_free(key);
> 
> In my case:
> After "X509_free(x509);" the "key" pointer is freed.
> So "EVP_PKEY_free(key);" would crash.
> Am I missing something here?
> 

The reference count is upped in X509_get_pubkey() so it is just
decremented by X509_free() and EVP_PKEY_free() actually frees it up.

If I recall this behaviour was first added in OpenSSL 0.9.2.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to