]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: mworker: fix a FD leak of a sockpair upon a failed reload
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 28 Jan 2022 20:17:30 +0000 (21:17 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 28 Jan 2022 22:47:43 +0000 (23:47 +0100)
commit55a921c9147c2d45621964428c86c5ceb9fd31d8
tree54db1d1f0fecc9b5b6b813028179a0aff8994097
parent4c943fd60b0cf460d5277e2af7d8d0436191d9a4
BUG/MINOR: mworker: fix a FD leak of a sockpair upon a failed reload

When starting HAProxy in master-worker, the master pre-allocate a struct
mworker_proc and do a socketpair() before the configuration parsing. If
the configuration loading failed, the FD are never closed because they
aren't part of listener, they are not even in the fdtab.

This patch fixes the issue by cleaning the mworker_proc structure that
were not asssigned a process, and closing its FDs.

Must be backported as far as 2.0, the srv_drop() only frees the memory
and could be dropped since it's done before an exec().
include/haproxy/mworker.h
src/haproxy.c
src/mworker.c