]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: perform lbprm deinit for dynamic servers
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 12 May 2025 14:27:43 +0000 (16:27 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 12 May 2025 14:29:36 +0000 (16:29 +0200)
Last commit 7361515 ("BUG/MINOR: server: dont depend on proxy for server
cleanup in srv_drop()") introduced a regression because the lbprm
server_deinit is not evaluated anymore with dynamic servers, possibly
resulting in a memory leak.

To fix the issue, in addition to free_proxy(), the server deinit check
should be manually performed in cli_parse_delete_server() as well.

No backport needed.

src/server.c

index 8ccb1bc42061ca1f3ccea92eac07ab8633c06315..526abb623af09325be80e41b9854ee100f74e7cc 100644 (file)
@@ -6276,6 +6276,9 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap
        if (srv->agent.state & CHK_ST_CONFIGURED)
                check_purge(&srv->agent);
 
+       if (srv->proxy->lbprm.server_deinit)
+               srv->proxy->lbprm.server_deinit(srv);
+
        while (!MT_LIST_ISEMPTY(&srv->watcher_list)) {
                srv_watch = MT_LIST_NEXT(&srv->watcher_list, struct watcher *, el);
                BUG_ON(srv->next && srv->next->flags & SRV_F_DELETED);