BUG/MINOR: haproxy: Free proxy->format_unique_id during deinit
authorTim Duesterhus <tim@bastelstu.be>
Sat, 4 Jul 2020 09:49:40 +0000 (11:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jul 2020 14:52:35 +0000 (16:52 +0200)
commit797657875f385ca26c222d142d46376b936680e6
treebf84908825df9d4c3fc983c08dd7b509981c0480
parent867cd98546862f4813ed8dd908545c8f18c397eb
BUG/MINOR: haproxy: Free proxy->format_unique_id during deinit

Given the following example configuration:

    frontend foo
     mode http
     bind *:8080
     unique-id-format x

Running a configuration check with valgrind reports:

    ==30712== 42 (40 direct, 2 indirect) bytes in 1 blocks are definitely lost in loss record 18 of 39
    ==30712==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==30712==    by 0x4ED7E9: add_to_logformat_list (log.c:462)
    ==30712==    by 0x4EEE28: parse_logformat_string (log.c:720)
    ==30712==    by 0x47B09A: check_config_validity (cfgparse.c:3046)
    ==30712==    by 0x52881D: init (haproxy.c:2121)
    ==30712==    by 0x41F382: main (haproxy.c:3126)

After this patch is applied the leak is gone as expected.

This is a very minor leak that can only be observed if deinit() is called,
shortly before the OS will free all memory of the process anyway. No
backport needed.
src/haproxy.c