diff --git a/include/types/proxy.h b/include/types/proxy.h index 641bc1c7b..9bfa68def 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -354,7 +354,7 @@ struct proxy { char *logformat_string; /* log format string */ char *uniqueid_format_string; /* unique-id format string */ struct { - const char *file; /* file where the section appears */ + char *file; /* file where the section appears */ int line; /* line where the section appears */ struct eb32_node id; /* place in the tree of used IDs */ struct eb_root used_listener_id;/* list of listener IDs in use */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 91b4b7f13..bc9d93f86 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1242,7 +1242,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) curpeers->next = peers; peers = curpeers; - curpeers->conf.file = file; + curpeers->conf.file = strdup(file); curpeers->conf.line = linenum; curpeers->last_change = now.tv_sec; curpeers->id = strdup(args[1]); @@ -1279,7 +1279,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) newpeer->next = curpeers->remote; curpeers->remote = newpeer; newpeer->peers = curpeers; - newpeer->conf.file = file; + newpeer->conf.file = strdup(file); newpeer->conf.line = linenum; newpeer->last_change = now.tv_sec; @@ -1451,7 +1451,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) init_new_proxy(curproxy); curproxy->next = proxy; proxy = curproxy; - curproxy->conf.file = file; + curproxy->conf.file = strdup(file); curproxy->conf.line = linenum; curproxy->last_change = now.tv_sec; curproxy->id = strdup(args[1]); @@ -3913,7 +3913,7 @@ stats_error_parsing: newsrv->next = curproxy->srv; curproxy->srv = newsrv; newsrv->proxy = curproxy; - newsrv->conf.file = file; + newsrv->conf.file = strdup(file); newsrv->conf.line = linenum; LIST_INIT(&newsrv->actconns); diff --git a/src/haproxy.c b/src/haproxy.c index b9179f001..8ac86cd76 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -852,6 +852,7 @@ void deinit(void) deinit_signals(); while (p) { + free(p->conf.file); free(p->id); free(p->check_req); free(p->cookie_name);