MINOR: proxy: also store the name for a defaults section
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 12:33:03 +0000 (13:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Feb 2021 15:23:46 +0000 (16:23 +0100)
There's an optional name, but till now it was not even saved into the
structure, let's keep it.

src/cfgparse-listen.c
src/proxy.c

index 56cab53..3c252d2 100644 (file)
@@ -261,6 +261,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                init_new_proxy(curr_defproxy);
                proxy_preset_defaults(curr_defproxy);
                curproxy = curr_defproxy;
+               curproxy->id = strdup(args[1]); // may be empty
                curproxy->conf.args.file = curproxy->conf.file = strdup(file);
                curproxy->conf.args.line = curproxy->conf.line = linenum;
                defproxy.cap = PR_CAP_DEF | PR_CAP_LISTEN; /* all caps for now */
index a0aaa5c..5351880 100644 (file)
@@ -1111,6 +1111,7 @@ void proxy_preset_defaults(struct proxy *defproxy)
  */
 void proxy_free_defaults(struct proxy *defproxy)
 {
+       free(defproxy->id); defproxy->id = NULL;
        free(defproxy->conf.file); defproxy->conf.file = NULL;
        free(defproxy->check_command); defproxy->check_command = NULL;
        free(defproxy->check_path); defproxy->check_path = NULL;