BUG/MINOR: connection: prevent null deref on mux cleanup task allocation

Move the code to allocate/free the mux cleanup task outside of the polling
loop. A new thread_alloc/free handler is registered for this in
connection.c.

This has the benefit to clean up the polling loop code. And as another
benefit, if the task allocation fails, the handler can report an error
to exit the haproxy process. This prevents a potential null pointer
dereferencing.

This should fix the github issue #1389.

This must be backported up to 2.4.

(cherry picked from commit 4837293ca0a1cc8c55ee9b84e66ee30bc755c291)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
2 files changed