BUG/MEDIUM: captures: free() an error capture out of the proxy lock

Ed Hein reported in github issue #1856 some occasional watchdog panics
in 2.4.18 showing extreme contention on the proxy's lock while the libc
was in malloc()/free(). One cause of this problem is that we call free()
under the proxy's lock in proxy_capture_error(), which makes no sense
since if we can free the object under the lock after it's been detached,
we can also free it after releasing the lock (since it's not referenced
anymore).

This should be backported to all relevant versions, likely all
supported ones.

(cherry picked from commit da9f25875958757fd1f16b74bd887977e78c8b09)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 61b4de015c6cdc87c43f084d91ad386262249109)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 487c94f0b9423e2fbf576980d701a09609d278ed)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed