MINOR: ssl: move the ckch/crtlist deinit to ssl_sock.c

Move the ckch_deinit() and crtlist_deinit() call to ssl_sock.c,
also unlink the SNI from the ckch_inst because they are free'd before in
ssl_sock_free_all_ctx().
This commit is contained in:
William Lallemand 2020-06-24 09:54:29 +02:00 committed by William Lallemand
parent 9ab8f8d1b6
commit b24086923c
2 changed files with 11 additions and 6 deletions

View File

@ -116,8 +116,6 @@
#include <haproxy/server.h>
#include <haproxy/session.h>
#include <haproxy/signal.h>
#include <haproxy/ssl_ckch.h>
#include <haproxy/ssl_crtlist.h>
#include <haproxy/ssl_sock.h>
#include <haproxy/stream.h>
#include <haproxy/task.h>
@ -2787,10 +2785,6 @@ void deinit(void)
free(l);
}
/* SSL storage */
crtlist_deinit(); /* must be free'd before the ckchs */
ckch_deinit();
/* Release unused SSL configs. */
list_for_each_entry_safe(bind_conf, bind_back, &p->conf.bind, by_fe) {
if (bind_conf->xprt->destroy_bind_conf)

View File

@ -4763,6 +4763,7 @@ void ssl_sock_free_all_ctx(struct bind_conf *bind_conf)
back = ebmb_next(node);
ebmb_delete(node);
SSL_CTX_free(sni->ctx);
LIST_DEL(&sni->by_ckch_inst);
free(sni);
node = back;
}
@ -4778,9 +4779,11 @@ void ssl_sock_free_all_ctx(struct bind_conf *bind_conf)
free(sni->conf);
sni->conf = NULL;
}
LIST_DEL(&sni->by_ckch_inst);
free(sni);
node = back;
}
SSL_CTX_free(bind_conf->initial_ctx);
bind_conf->initial_ctx = NULL;
SSL_CTX_free(bind_conf->default_ctx);
@ -4788,6 +4791,14 @@ void ssl_sock_free_all_ctx(struct bind_conf *bind_conf)
bind_conf->default_ssl_conf = NULL;
}
void ssl_sock_deinit()
{
crtlist_deinit(); /* must be free'd before the ckchs */
ckch_deinit();
}
REGISTER_POST_DEINIT(ssl_sock_deinit);
/* Destroys all the contexts for a bind_conf. This is used during deinit(). */
void ssl_sock_destroy_bind_conf(struct bind_conf *bind_conf)
{