]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: ssl: fix memory leak in ssl_fc_crtname by using SSL_CTX ex_data index
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 3 Apr 2026 08:58:48 +0000 (10:58 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 3 Apr 2026 09:00:36 +0000 (11:00 +0200)
commite42f381bfc6ff62aaa5b9355d4b5dd763d6b19aa
tree7c36cbd04c084845ec0fcbfbef6fafce07942ad4
parentf1bf8dd1480abefc29fefa785ce87e1c64c4a25f
BUG/MINOR: ssl: fix memory leak in ssl_fc_crtname by using SSL_CTX ex_data index

The ssl_crtname_index was registered with SSL_get_ex_new_index() but the
certificate name is stored on a SSL_CTX object via SSL_CTX_set_ex_data().
The free callback is only invoked for the object type matching the index
registration, so the strdup'd name was never freed when the SSL_CTX was
released.

Fix this by using SSL_CTX_get_ex_new_index() instead, which ensures the
free callback fires when the SSL_CTX is destroyed.

No backport needed.
src/ssl_sock.c