BUG/MINOR: tcpcheck: Fix double free on error path when parsing tcp/http-check
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 11:00:14 +0000 (12:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 12:21:20 +0000 (13:21 +0100)
commit37e583d80dfb3fabdfaeb9a6daa31d84bc199fe9
tree8c9edffc640b16ac6175385508714df19ed5adfe
parente3f9f2bd9df54a3c05d9e3b21fadc39d771853a9
BUG/MINOR: tcpcheck: Fix double free on error path when parsing tcp/http-check

When a "tcp-check" or a "http-check" rule is parsed, we try to get the
previous rule in the ruleset to get its index. We must take care to reset
the pointer on this rule in case an error is triggered later on the
parsing. Otherwise, the same rule may be released twice. For instance, it
happens with such line :

    http-check meth GET uri / ## note there is no "send" parameter

This patch must be backported as far as 2.2.

(cherry picked from commit cd03be73d59ad2c5d9ad43b28a1b0fda9f32526c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/check.c
src/tcpcheck.c