mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
BUG/MINOR: stats: free dynamically stats fields/lines on shutdown
Register a new function on POST DEINIT to free stats fields/lines for each domain. This patch does not fix a critical bug but may be backported to 2.3.
This commit is contained in:
parent
cc9bf2e5fe
commit
a2a6899bee
17
src/stats.c
17
src/stats.c
@ -4548,6 +4548,23 @@ static int allocate_stats_dns_postcheck(void)
|
|||||||
|
|
||||||
REGISTER_CONFIG_POSTPARSER("allocate-stats-dns", allocate_stats_dns_postcheck);
|
REGISTER_CONFIG_POSTPARSER("allocate-stats-dns", allocate_stats_dns_postcheck);
|
||||||
|
|
||||||
|
static void deinit_stats(void)
|
||||||
|
{
|
||||||
|
int domains[] = { STATS_DOMAIN_PROXY, STATS_DOMAIN_DNS }, i;
|
||||||
|
|
||||||
|
for (i = 0; i < STATS_DOMAIN_COUNT; ++i) {
|
||||||
|
const int domain = domains[i];
|
||||||
|
|
||||||
|
if (stat_l[domain])
|
||||||
|
free(stat_l[domain]);
|
||||||
|
|
||||||
|
if (stat_f[domain])
|
||||||
|
free(stat_f[domain]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_POST_DEINIT(deinit_stats);
|
||||||
|
|
||||||
/* register cli keywords */
|
/* register cli keywords */
|
||||||
static struct cli_kw_list cli_kws = {{ },{
|
static struct cli_kw_list cli_kws = {{ },{
|
||||||
{ { "clear", "counters", NULL }, "clear counters : clear max statistics counters (add 'all' for all counters)", cli_parse_clear_counters, NULL, NULL },
|
{ { "clear", "counters", NULL }, "clear counters : clear max statistics counters (add 'all' for all counters)", cli_parse_clear_counters, NULL, NULL },
|
||||||
|
Loading…
Reference in New Issue
Block a user