[openssl-users] Issue with freeing X509
Adi Mallikarjuna Reddy V
adimallikarjunareddy at gmail.com
Tue Oct 17 13:39:56 UTC 2017
Hi,
If I have an X509 object and is created using PEM_read_bio_X509_AUX(), then
Can I free X509 right after the completion of PEM_read_bio_X509_AUX()?
BIO *cert_bio = BIO_new(BIO_s_mem());
X509 *cert = X509_new();
BIO_puts(cert_bio, cert_str.c_str());
cert = PEM_read_bio_X509_AUX(cert_bio,
&cert, NULL, NULL);
if ( (cert != NULL) &&
SSL_CTX_use_certificate(ctx, cert) < 1) {
SSL_CTX_free(ctx);
return NULL;
}
if(cert_bio !=NULL) {
BIO_free(cert_bio);
}
if(cert != NULL) {
X509_free(cert); //is it needed?
}
Thanks
Adi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20171017/31edae93/attachment.html>
More information about the openssl-users
mailing list