From: Willy Tarreau Date: Thu, 19 Sep 2024 13:06:09 +0000 (+0200) Subject: CLEANUP: stick-table: make the file location point to a global file name X-Git-Tag: v3.1-dev9~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ab21a3c2d07c29c72d0c230778d224458af51a2;p=thirdparty%2Fhaproxy.git CLEANUP: stick-table: make the file location point to a global file name 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. --- diff --git a/include/haproxy/stick_table-t.h b/include/haproxy/stick_table-t.h index 3aa55e378e..dea1e982a6 100644 --- a/include/haproxy/stick_table-t.h +++ b/include/haproxy/stick_table-t.h @@ -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 the stick-table is declared. */ } conf; }; diff --git a/src/stick_table.c b/src/stick_table.c index f69146d1d1..f49fb0af59 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -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;