]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stick-table: make the file location point to a global file name
authorWilly Tarreau <w@1wt.eu>
Thu, 19 Sep 2024 13:06:09 +0000 (15:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Sep 2024 13:38:19 +0000 (15:38 +0200)
The file name used to point to the calling function's stack for stick
tables, which was OK during parsing but remained dangling afterwards.
At least it was already marked const so as not to accidentally free it.
Let's make it point to a file_name_node now.

include/haproxy/stick_table-t.h
src/stick_table.c

index 3aa55e378e7100de46f13d9f87655283b9fb4bfa..dea1e982a62ae2e8cc12b636fbbab82ba3624a2b 100644 (file)
@@ -224,7 +224,7 @@ struct stktable {
        /* rarely used config stuff below (should not interfere with updt_lock) */
        struct proxy *proxies_list; /* The list of proxies which reference this stick-table. */
        struct {
-               const char *file;     /* The file where the stick-table is declared. */
+               const char *file;     /* The file where the stick-table is declared (global name). */
                int line;             /* The line in this <file> the stick-table is declared. */
        } conf;
 };
index f69146d1d149abe7b3c722cedf9b087d08836a53..f49fb0af5963ff81f03e3b9c7dc5261c2581043e 100644 (file)
@@ -1181,7 +1181,7 @@ int parse_stick_table(const char *file, int linenum, char **args,
        t->idlen = strlen(id);
        t->nid =  nid;
        t->type = (unsigned int)-1;
-       t->conf.file = file;
+       t->conf.file = copy_file_name(file);
        t->conf.line = linenum;
        t->write_to.name = NULL;
        t->brates_factor = 1;