BUG/MINOR: map/cli: make sure patterns don't vanish under "show map"'s init

When "show map" initializes itself, it first takes the reference to the
starting point under a lock, then releases it before switching to state
STATE_LIST, and takes the lock again. The problem is that it is possible
for another thread to remove the first element during this unlock/lock
sequence, and make the list run anywhere. This is of course extremely
unlikely but not impossible.

Let's initialize the pointer in the STATE_LIST part under the same lock,
which is simpler and more reliable.

This should be backported to all versions.

(cherry picked from commit 1ae0c43244254a3cf652300413625191d6a9dd4f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 33f525cfcb7429443e8ac5e7ff338b22dfb2d34d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed