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:17:46 +0000 (13:17 +0100)
commitcd03be73d59ad2c5d9ad43b28a1b0fda9f32526c
tree2761a2b38376176de0145fc05674dd4391d281b9
parent77e376783e891fe5dda4fe4e1198cf8dff0b118d
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.
src/tcpcheck.c