From: Tim Duesterhus Date: Sat, 4 Jul 2020 09:49:40 +0000 (+0200) Subject: BUG/MINOR: haproxy: Free proxy->format_unique_id during deinit X-Git-Tag: v2.3-dev1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=797657875f385ca26c222d142d46376b936680e6;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/haproxy.c b/src/haproxy.c index 6c5566467a..4b3800ae0c 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2712,6 +2712,13 @@ void deinit(void) free(lf); } + list_for_each_entry_safe(lf, lfb, &p->format_unique_id, list) { + LIST_DEL(&lf->list); + release_sample_expr(lf->expr); + free(lf->arg); + free(lf); + } + deinit_act_rules(&p->tcp_req.inspect_rules); deinit_act_rules(&p->tcp_rep.inspect_rules); deinit_act_rules(&p->tcp_req.l4_rules);