BUG/MINOR: resolvers: Fix memory leak in resolvers_deinit()

A config like the following:

    global
    	stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners

    resolvers unbound
    	nameserver unbound 127.0.0.1:53

will report the following leak when running a configuration check:

    ==241882== 6,991 (6,952 direct, 39 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 13
    ==241882==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==241882==    by 0x25938D: cfg_parse_resolvers (resolvers.c:3193)
    ==241882==    by 0x26A1E8: readcfgfile (cfgparse.c:2171)
    ==241882==    by 0x156D72: init (haproxy.c:2016)
    ==241882==    by 0x156D72: main (haproxy.c:3037)

because the `.px` member of `struct resolvers` is not freed.

The offending allocation was introduced in
c943799c865c04281454a7a54fd6c45c2b4d7e09 which is a reorganization that
happened during development of 2.4.x. This fix can likely be backported without
issue to 2.4+ and is likely not needed for earlier versions as the leak happens
during deinit only.

(cherry picked from commit 0b7031b37d729c55b7b4390f3c8328201654e0d7)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 17b306e23d952c8e29b181c5e04881a72f8b7cf6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed