From: Tim Duesterhus Date: Sat, 4 Jul 2020 09:49:42 +0000 (+0200) Subject: BUG/MINOR: haproxy: Free proxy->unique_id_header during deinit X-Git-Tag: v2.3-dev1~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18c63591f0c9f8e6ffeffb5ecfbbd96047251b5b;p=thirdparty%2Fhaproxy.git BUG/MINOR: haproxy: Free proxy->unique_id_header during deinit Given the following example configuration: frontend foo mode http bind *:8080 unique-id-header x Running a configuration check with valgrind reports: ==17621== 2 bytes in 1 blocks are definitely lost in loss record 1 of 341 ==17621== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==17621== by 0x649E489: strdup (strdup.c:42) ==17621== by 0x4A87F1: cfg_parse_listen (cfgparse-listen.c:2747) ==17621== by 0x494C59: readcfgfile (cfgparse.c:2049) ==17621== by 0x545095: init (haproxy.c:2029) ==17621== by 0x421E42: main (haproxy.c:3167) 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 862f68d5fa..9d97d48d01 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2626,6 +2626,7 @@ void deinit(void) free(p->conf.lfs_file); free(p->conf.uniqueid_format_string); + istfree(&p->header_unique_id); free(p->conf.uif_file); if ((p->lbprm.algo & BE_LB_LKUP) == BE_LB_LKUP_MAP) free(p->lbprm.map.srv);