<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<tt>You only asked about freeing the X509, which is safe in this
situation.<br>
<br>
It is not safe to free the SSL_CTX if you want to use it again
later -- remove this SSL_CTX_free(ctx) call and put one in your program's
cleanup instead.<br>
<br>
-Ben<br>
</tt><br>
<div class="moz-cite-prefix">On 10/17/2017 11:08 AM, Adi
Mallikarjuna Reddy V wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABexLuZugLTwWE_Y9iWFdKhOK_4A+QcUia07aVO6GLKhsDE-eg@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div>
<div dir="auto">Forgot to mention that the ssl_ctx is going to
be used by another thread later. When I do x509_free, the
handshake doesn’t finish.</div>
<div dir="auto"><br>
</div>
<div dir="auto">I see a crash in ssl_accept.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks </div>
<div dir="auto">Adi</div>
<br>
<div class="gmail_quote">
<div>On Tue, Oct 17, 2017 at 8:41 AM Benjamin Kaduk <<a
href="mailto:bkaduk@akamai.com" moz-do-not-send="true">bkaduk@akamai.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> On 10/17/2017 08:39
AM, Adi Mallikarjuna Reddy V wrote:<br>
<blockquote type="cite">
<div><span style="font-size:12.8px">Hi,</span>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">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()?</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">
<div> BIO *cert_bio =
BIO_new(BIO_s_mem());</div>
<div> X509 *cert =
X509_new();</div>
<div>
BIO_puts(cert_bio, cert_str.c_str());</div>
<div> cert =
PEM_read_bio_X509_AUX(cert_bio, &cert, NULL,
NULL);</div>
<div> if ( (cert !=
NULL) && SSL_CTX_use_certificate(ctx,
cert) < 1) {</div>
<div>
SSL_CTX_free(ctx);</div>
</div>
</div>
</blockquote>
<br>
</div>
<div text="#000000" bgcolor="#FFFFFF"> Yes.<br>
<br>
-Ben</div>
<div text="#000000" bgcolor="#FFFFFF"><br>
<br>
<blockquote type="cite">
<div>
<div style="font-size:12.8px">
<div> return
NULL;</div>
<div> }</div>
<div> </div>
<div> if(cert_bio
!=NULL) {</div>
<div>
BIO_free(cert_bio);</div>
<div> }</div>
<div> if(cert !=
NULL) {</div>
<div>
X509_free(cert); //is it needed?</div>
<div> }</div>
</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">Thanks</div>
<div style="font-size:12.8px">Adi</div>
</div>
<br>
<fieldset
class="m_7406849727341148149mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</div>
</blockquote>
</div>
</div>
<div dir="ltr">-- <br>
</div>
<div class="gmail_signature" data-smartmail="gmail_signature">Sent
from Mobile</div>
</blockquote>
<br>
</body>
</html>