BUG/MINOR: converters: Store the sink in an arg pointer for debug() converter
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Aug 2020 12:00:23 +0000 (14:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2020 09:36:53 +0000 (11:36 +0200)
commite9768f22d19276332ec16db585af6d1de0503931
treee2511d07dabc096f408e945951f240256c26e6ea
parentb762578728f019509fc7b14402ab40d4ee024d73
BUG/MINOR: converters: Store the sink in an arg pointer for debug() converter

The debug() converter uses a string to reference the sink where to send debug
events. During the configuration parsing, this string is converted to a sink
object but it is still store as a string argument. It is a problem on deinit
because string arguments are released. So the sink pointer will be released
twice.

To fix the bug, we keep a reference on the sink using an ARGT_PTR argument. This
way, it will not be freed on the deinit.

This patch depends on the commit e02fc4d0d ("MINOR: arg: Add an argument type to
keep a reference on opaque data"). Both must be backported as far as 2.1.

(cherry picked from commit b45bf8eb70789264b9fd38fd6c1bc1c1c723ffe3)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit c89077713915f605eb5d716545f182c8d0bf5581)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/sample.c