From: Willy Tarreau Date: Thu, 21 Apr 2022 12:14:28 +0000 (+0200) Subject: BUG/MEDIUM: logs: fix http-client's log srv initialization X-Git-Tag: v2.6-dev7~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1e9f6bbe5af49b275493ce78fbd000542642792;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: logs: fix http-client's log srv initialization As anticipated in commit 211ea252d ("BUG/MINOR: logs: fix logsrv leaks on clean exit"), there were indeed other corner cases that were not properly covered. Setting the http client's ring_name to NULL make the sink lookup crash on startup in sink_find () with a config as simple as: global log ring@buf0 local0 The fields must be properly initialized (both config file name and the ring_name). This only needs to be backported if/when the commit above is backported. --- diff --git a/src/http_client.c b/src/http_client.c index f1e5345a65..6bf28d03b9 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -1089,9 +1089,8 @@ static int httpclient_cfg_postparser() memcpy(node, logsrv, sizeof(*node)); LIST_INIT(&node->list); LIST_APPEND(&curproxy->logsrvs, &node->list); - node->ring_name = NULL; - node->conf.file = NULL; - node->conf.line = 0; + node->ring_name = logsrv->ring_name ? strdup(logsrv->ring_name) : NULL; + node->conf.file = logsrv->conf.file ? strdup(logsrv->conf.file) : NULL; } if (curproxy->conf.logformat_string) { curproxy->conf.args.ctx = ARGC_LOG;