]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: log: free logformat expr on compile failure in cfg_parse_log_profile
authorWilly Tarreau <w@1wt.eu>
Fri, 22 May 2026 08:49:17 +0000 (08:49 +0000)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 May 2026 08:52:42 +0000 (10:52 +0200)
When lf_expr_compile() fails in cfg_parse_log_profile, the code leaves
without freeing the previously strdup()'d strings in target_lf->str and
target_lf->conf.file. Let's add a call to lf_expr_deinit() there to
release it.

It was harmless anyway since the startup will abort when this happens,
but better clean it because with increasingly dynamic setups, one day
it could become a runtime leak.

No backport is needed.

src/log.c

index c8f85695b1e1dc6769d254a921e1be8ee2037548..2a6f4c232e85c91c052c69a4f26b71e2131a2eb9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -6743,6 +6743,7 @@ int cfg_parse_log_profile(const char *file, int linenum, char **args, int kwm)
                                             SMP_VAL_FE_LOG_END, &errmsg)) {
                                ha_alert("Parsing [%s:%d]: failed to parse logformat: %s.\n",
                                         file, linenum, errmsg);
+                               lf_expr_deinit(target_lf);
                                err_code |= ERR_ALERT | ERR_FATAL;
                                goto out;
                        }