BUILD: listener: shut report of possible null-deref in listener_accept()
authorWilly Tarreau <w@1wt.eu>
Mon, 9 May 2022 18:41:54 +0000 (20:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 May 2022 18:49:36 +0000 (20:49 +0200)
commitd86793479fbd21a976d5baa0bbc383c65cfac490
tree807edcfa76715aa491f81af0b0777ca88df5b23b
parent8a0fd3a36c0c6cd4bd73f15481d5fb68ac75681e
BUILD: listener: shut report of possible null-deref in listener_accept()

When building without threads, gcc 12 says that there's a null-deref in
_HA_ATOMIC_INC() called from listener_accept(). It's just that the code
was originally written in an attempt not to always have a proxy for a
listener and that there are two places where the pointer is tested before
being used, so the compiler concludes that the pointer might be null
hence that other places are null-derefs.

In practice the pointer cannot be null there (and never has been), but
since that code was initially built that way and it's only a matter of
adding a pair of braces to shut it up, let's respect that initial
attempt in case one day we need it.

This one was also reported by Ilya in issue #1513, though with threads
enabled in his case.

This may have to be backported if users complain about new breakage with
gcc-12.
src/listener.c