]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: log: use free_logformat_list() in parse_logformat_string()
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 22 Feb 2024 14:08:33 +0000 (15:08 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 22 Feb 2024 14:32:42 +0000 (15:32 +0100)
This is a follow up for 24a5e42db6 ("CLEANUP: log: deinitialization of
the log buffer in one function") as there was another opportunity to
make use of the new cleanup function.

src/log.c

index 7e68039443676e25ef40287650fc14acee3af4e9..b0d02216437540452adeb3b253d7a76346b6d3e9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -515,7 +515,6 @@ int parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
        int typecast = SMP_T_SAME; /* relaxed by default */
        int cformat; /* current token format */
        int pformat; /* previous token format */
-       struct logformat_node *tmplf, *back;
 
        sp = str = backfmt = strdup(fmt);
        if (!str) {
@@ -525,12 +524,7 @@ int parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
        curproxy->to_log |= LW_INIT;
 
        /* flush the list first. */
-       list_for_each_entry_safe(tmplf, back, list_format, list) {
-               LIST_DELETE(&tmplf->list);
-               release_sample_expr(tmplf->expr);
-               free(tmplf->arg);
-               free(tmplf);
-       }
+       free_logformat_list(list_format);
 
        for (cformat = LF_INIT; cformat != LF_END; str++) {
                pformat = cformat;