BUG/MINOR: config: fix leak on proxy.conn_src.bind_hdr_name
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 26 Jan 2021 13:35:22 +0000 (14:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 Jan 2021 13:48:39 +0000 (14:48 +0100)
Leak for parsing of option usesrc of the source keyword.

This can be backported to 1.8.

src/cfgparse-listen.c
src/haproxy.c

index 588ff97..689a28e 100644 (file)
@@ -2915,6 +2915,7 @@ stats_error_parsing:
 
                                        curproxy->conn_src.opts &= ~CO_SRC_TPROXY_MASK;
                                        curproxy->conn_src.opts |= CO_SRC_TPROXY_DYN;
+                                       free(curproxy->conn_src.bind_hdr_name);
                                        curproxy->conn_src.bind_hdr_name = calloc(1, end - name + 1);
                                        curproxy->conn_src.bind_hdr_len = end - name;
                                        memcpy(curproxy->conn_src.bind_hdr_name, name, end - name);
index e36e020..cdbc3dc 100644 (file)
@@ -2503,6 +2503,9 @@ void deinit(void)
                free(p->rdp_cookie_name);
                free(p->invalid_rep);
                free(p->invalid_req);
+#if defined(CONFIG_HAP_TRANSPARENT)
+               free(p->conn_src.bind_hdr_name);
+#endif
                if (p->conf.logformat_string != default_http_log_format &&
                    p->conf.logformat_string != default_tcp_log_format &&
                    p->conf.logformat_string != clf_http_log_format)