]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: move the ckch/crtlist deinit to ssl_sock.c
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 24 Jun 2020 07:54:29 +0000 (09:54 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 24 Jun 2020 07:57:18 +0000 (09:57 +0200)
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().

src/haproxy.c
src/ssl_sock.c

index 22b43831af49681b0c8ab8e517a22a78091c3699..802a88fbe6bb313cb4df1bd1ec3b6350a479420f 100644 (file)
 #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)
index 715ae9d67219f5e4271bea02cad40dfec4b0a49c..dce5c64f9865518c18afa9bf7e21be5321091970 100644 (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)
 {