projects
/
haproxy-2.5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1cdc028
)
BUG/MINOR: sock: Unclosed fd in case of connection allocation failure
author
Remi Tricot-Le Breton
<rlebreton@haproxy.com>
Thu, 14 Jan 2021 14:26:24 +0000
(15:26 +0100)
committer
Christopher Faulet
<cfaulet@haproxy.com>
Fri, 5 Feb 2021 11:14:51 +0000
(12:14 +0100)
If allocating a connection object failed right after a successful accept
on a listener, the new file descriptor was not properly closed.
This fixes GitHub issue #905.
It can be backported to 2.3.
src/sock.c
patch
|
blob
|
history
diff --git
a/src/sock.c
b/src/sock.c
index
20ebdd0
..
596be43
100644
(file)
--- a/
src/sock.c
+++ b/
src/sock.c
@@
-161,6
+161,9
@@
struct connection *sock_accept_conn(struct listener *l, int *status)
fail_conn:
sockaddr_free(&addr);
+ /* The accept call already succeeded by the time we try to allocate the connection,
+ * we need to close it in case of failure. */
+ close(cfd);
fail_addr:
ret = CO_AC_PAUSE;
goto done;