]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: listener: close before free in `listener_accept`
authorWilliam Dauchy <wdauchy@gmail.com>
Sun, 18 Oct 2020 16:37:43 +0000 (18:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Oct 2020 13:40:36 +0000 (15:40 +0200)
safer to close handle before the object is put back in the global pool.

this was introduced by commit 9378bbe0bef4005155d ("MEDIUM: listener:
use protocol->accept_conn() to accept a connection")

this should fix github issue #902

no backport needed.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
src/listener.c

index 85191f50bac7a01138d7399b5ad121ba566c6d2c..7061f9a9daa3c0f752d74d8edc944da36fbf44cc 100644 (file)
@@ -855,8 +855,8 @@ void listener_accept(struct listener *l)
                        send_log(p, LOG_EMERG,
                                 "Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n",
                                 p->id);
-                       conn_free(cli_conn);
                        close(cli_conn->handle.fd);
+                       conn_free(cli_conn);
                        expire = tick_add(now_ms, 1000); /* try again in 1 second */
                        goto limit_global;
                }