Fix more memory leaks and ssb shutdown order issues.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4825 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -46,12 +46,14 @@ bool tf_tls_context_set_certificate(tf_tls_context_t* context, const char* certi
|
||||
BIO_puts(bio, certificate);
|
||||
X509* x509 = PEM_read_bio_X509(bio, 0, 0, 0);
|
||||
result = SSL_CTX_use_certificate(context->context, x509);
|
||||
X509_free(x509);
|
||||
while (true)
|
||||
{
|
||||
x509 = PEM_read_bio_X509(bio, 0, 0, 0);
|
||||
if (x509)
|
||||
{
|
||||
SSL_CTX_add_extra_chain_cert(context->context, x509);
|
||||
X509_free(x509);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -69,6 +71,7 @@ bool tf_tls_context_set_private_key(tf_tls_context_t* context, const char* priva
|
||||
BIO_puts(bio, private_key);
|
||||
EVP_PKEY* key = PEM_read_bio_PrivateKey(bio, 0, 0, 0);
|
||||
result = SSL_CTX_use_PrivateKey(context->context, key);
|
||||
EVP_PKEY_free(key);
|
||||
BIO_free(bio);
|
||||
return result == 1;
|
||||
}
|
||||
@ -106,6 +109,7 @@ tf_tls_session_t* tf_tls_context_create_session(tf_tls_context_t* context)
|
||||
void tf_tls_context_destroy(tf_tls_context_t* context)
|
||||
{
|
||||
SSL_CTX_free(context->context);
|
||||
OPENSSL_cleanup();
|
||||
tf_free(context);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user