]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: ssl: Release cached SSL sessions on deinit
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2020 11:20:23 +0000 (13:20 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2020 12:07:29 +0000 (14:07 +0200)
On deinit, when the server SSL ctx is released, we must take care to release the
cached SSL sessions stored in the array <ssl_ctx.reused_sess>. There are
global.nbthread entries in this array, each one may have a pointer on a cached
session.

This patch should fix the issue #802. No backport needed.

src/ssl_sock.c

index aa9061a6b3da1377d995d2497b6a84ca1c02e76b..cce06cd62f7be91aa127223f815cf46da14ab8b7 100644 (file)
@@ -4721,6 +4721,14 @@ void ssl_sock_free_srv_ctx(struct server *srv)
        if (srv->ssl_ctx.npn_str)
                free(srv->ssl_ctx.npn_str);
 #endif
+       if (srv->ssl_ctx.reused_sess) {
+               int i;
+
+               for (i = 0; i < global.nbthread; i++)
+                       free(srv->ssl_ctx.reused_sess[i].ptr);
+               free(srv->ssl_ctx.reused_sess);
+       }
+
        if (srv->ssl_ctx.ctx)
                SSL_CTX_free(srv->ssl_ctx.ctx);
 }