From: Amaury Denoyelle Date: Tue, 10 Aug 2021 14:23:49 +0000 (+0200) Subject: BUG/MEDIUM: check: fix leak on agent-check purge X-Git-Tag: v2.5-dev4~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26cb8342ad0084e61d81ecaad948ce85843a29b4;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: check: fix leak on agent-check purge There is currently a leak on agent-check for dynamic servers. When deleted, the check rules and vars are not liberated. This leak grows each time a dynamic server with agent-check is deleted. Replace the manual purge code by a free_check invocation which centralizes all the details on check cleaning. There is no leak for health check because in this case the proxy is the owner of the check vars and rules. This should not be backported, unless dynamic server checks are backported. --- diff --git a/src/check.c b/src/check.c index 6225cc8feb..4a4e4c7709 100644 --- a/src/check.c +++ b/src/check.c @@ -1245,16 +1245,11 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) * after this point. */ if (unlikely(check->state & CHK_ST_PURGE)) { - /* buf_wait */ - LIST_DELETE(&check->buf_wait.list); - /* tasklet */ - pool_free(pool_head_tasklet, check->wait_list.tasklet); - /* task */ - task_destroy(check->task); - t = NULL; - + free_check(check); if (check->server) free_server(check->server); + + t = NULL; } return t;