]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
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)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Aug 2024 14:34:06 +0000 (16:34 +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.

src/proto_tcp.c

index 25d66bafddb79e0fd85a8d7960d5aec8c32c4dd2..e245a38c4f915a552a23ddd33a09b6394137f34e 100644 (file)
@@ -692,8 +692,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) {