BUG/MINOR: arg: Fix leaks during arguments validation for fetches/converters
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Aug 2020 21:07:07 +0000 (23:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2020 09:37:08 +0000 (11:37 +0200)
commit71a461b0e6a6a97c93f2d09eec74d53823bc4108
tree14bc021698d2cd2cd3278692bb29ee0bb73c3c9f
parentab70b9ef3362f276b63a14289741e20f4826613a
BUG/MINOR: arg: Fix leaks during arguments validation for fetches/converters

Some sample fetches or sample converters uses a validation functions for their
arguments. In these function, string arguments (ARGT_STR) may be converted to
another type (for instance a regex, a variable or a integer). Because these
strings are allocated when the argument list is built, they must be freed after
a conversion. Most of time, it is done. But not always. This patch fixes these
minor memory leaks (only on few strings, during the configuration parsing).

This patch may be backported to all supported versions, most probably as far as
2.1 only. If this commit is backported, the previous one 73292e9e6 ("BUG/MINOR:
lua: Duplicate map name to load it when a new Map object is created") must also
be backported. Note that some validation functions does not exists on old
version. It should be easy to resolve conflicts.

(cherry picked from commit 959171376f4974b883b2aa4228b3f8c610ca2ae9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 0e7c530357024c8aa20886a42570071c06595193)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/map.c
src/payload.c
src/sample.c