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().
diff --git a/src/haproxy.c b/src/haproxy.c
index 22b4383..802a88f 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -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 @@
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)
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 715ae9d..dce5c64 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -4763,6 +4763,7 @@
back = ebmb_next(node);
ebmb_delete(node);
SSL_CTX_free(sni->ctx);
+ LIST_DEL(&sni->by_ckch_inst);
free(sni);
node = back;
}
@@ -4778,15 +4779,25 @@
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);
bind_conf->default_ctx = NULL;
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)