BUG/MINOR: proto_tcp: keep error msg if listen() fails
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 7 Aug 2024 17:34:07 +0000 (19:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Sep 2024 16:38:52 +0000 (18:38 +0200)
If listen() fails, we need to keep the message about it, which is copied then
in errmsg buffer on the error path. This buffer is properly provided by the
caller (protocol_bind_all()) and reallocated if needed in memprintf(), but
it was deleted without being returned.

This can be backported to all stable versions.

(cherry picked from commit 81f48395b325b9875d215ec2743e75f7a56e1e5f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/proto_tcp.c

index a1a6a86..0355a0a 100644 (file)
@@ -684,8 +684,6 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
        goto tcp_return;
 
  tcp_close_return:
-       free_trash_chunk(msg);
-       msg = NULL;
        fd_delete(fd);
  tcp_return:
        if (msg && errlen && msg->data) {