BUG/MINOR: listener: fix incorrect return on out-of-memory
authorWilly Tarreau <w@1wt.eu>
Sat, 16 Oct 2021 12:45:29 +0000 (14:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 16 Oct 2021 12:45:29 +0000 (14:45 +0200)
commita146289d4f3b9940f20ae1640b26fa939761224b
tree58135fc6c2c10e34a893ad6b0de6f20909b6fff1
parentb39e47a52b19e7b62727393f9b8e8bd36330b550
BUG/MINOR: listener: fix incorrect return on out-of-memory

When the clone_listener() function was added in commit 59a877dfd
("MINOR: listeners: add clone_listener() to duplicate listeners at
boot time"), a stupid bug was introduced when splitting the error
path because while the first case where calloc fails will leave NULL
in the output value, the other cases will return the pointer to a
freed area. This was reported by Coverity in issue #1416.

In practice nobody will face it (out-of-memory while checking config),
but let's fix it.

No backport is needed.
src/listener.c