]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: haproxy: Free srule->file during deinit
authorTim Duesterhus <tim@bastelstu.be>
Sat, 4 Jul 2020 09:49:43 +0000 (11:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jul 2020 14:52:35 +0000 (16:52 +0200)
commit6fb74a1dc3e7aeb1092be05a46bbb75e2638e0aa
tree70f846455c22ef98b4b9b2f45f31636be20952e4
parent18c63591f0c9f8e6ffeffb5ecfbbd96047251b5b
BUG/MINOR: haproxy: Free srule->file during deinit

Given the following example configuration:

    backend foo
     mode http
     use-server x if { always_true }
     server x example.com:80

Running a configuration check with valgrind reports:

    ==18650== 14 bytes in 1 blocks are definitely lost in loss record 3 of 345
    ==18650==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==18650==    by 0x649E489: strdup (strdup.c:42)
    ==18650==    by 0x4A5438: cfg_parse_listen (cfgparse-listen.c:1548)
    ==18650==    by 0x494C59: readcfgfile (cfgparse.c:2049)
    ==18650==    by 0x5450B5: init (haproxy.c:2029)
    ==18650==    by 0x421E42: main (haproxy.c:3168)

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