BUG/MINOR: listener: Fix a possible null pointer dereference
It seems to be possible to have no frontend for a listener. A test was missing
before dereferencing it at the end of the function listener_accept().
This patch fixes the issue #264. It must be backported to 2.0 and 1.9.
(cherry picked from commit ad6c2eac28ed96ec8e8c90bd5ce68794ea6bf000)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/listener.c b/src/listener.c
index 54c0996..33ac6ce 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -1065,7 +1065,7 @@
if (!LIST_ISEMPTY(&global_listener_queue))
dequeue_all_listeners(&global_listener_queue);
- if (!LIST_ISEMPTY(&p->listener_queue) &&
+ if (p && !LIST_ISEMPTY(&p->listener_queue) &&
(!p->fe_sps_lim || freq_ctr_remain(&p->fe_sess_per_sec, p->fe_sps_lim, 0) > 0))
dequeue_all_listeners(&p->listener_queue);
}