Skip to content

Commit

Permalink
tls: clear session callbacks in destructor (#611)
Browse files Browse the repository at this point in the history
This fixes a segmentation fault that appear when the tls object is freed before
the SSL object and TLS session reuse was enabled.
  • Loading branch information
cspiel1 authored Dec 8, 2022
1 parent b455c71 commit c76111a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tls/openssl/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ static void destructor(void *data)
{
struct tls *tls = data;

if (tls->ctx)
if (tls->ctx) {
SSL_CTX_sess_set_new_cb(tls->ctx, NULL);
SSL_CTX_sess_set_remove_cb(tls->ctx, NULL);
SSL_CTX_free(tls->ctx);
}

if (tls->cert)
X509_free(tls->cert);
Expand Down

0 comments on commit c76111a

Please sign in to comment.