BUG/MINOR: server: Memory leak of proxy.used_server_addr during deinit
authorThayne McCombs <thayne@lucidchart.com>
Fri, 8 Jan 2021 05:11:05 +0000 (22:11 -0700)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 Jan 2021 06:22:15 +0000 (07:22 +0100)
GitHub Issue #1037 Reported a memory leak in deinit() caused by an
allocation made in sa2str() that was stored in srv_set_addr_desc().

When destroying each server for a proxy in deinit, include freeing the
memory in the key of server->addr_node.

The leak was introduced in commit 92149f9a8 ("MEDIUM: stick-tables: Add
srvkey option to stick-table") which is not in any released version so
no backport is needed.

Cc: Tim Duesterhus <tim@bastelstu.be>

src/haproxy.c

index fb73c54..fcc4f6c 100644 (file)
@@ -2649,6 +2649,7 @@ void deinit(void)
                        free(s->available_conns);
                        free(s->curr_idle_thr);
                        free(s->resolvers_id);
+                       free(s->addr_node.key);
 
                        if (s->use_ssl == 1 || s->check.use_ssl == 1 || (s->proxy->options & PR_O_TCPCHK_SSL)) {
                                if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->destroy_srv)