BUG/MINOR: stats: Init the metric variable when frontend stats are filled
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 25 Jan 2021 14:16:41 +0000 (15:16 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 25 Jan 2021 14:53:03 +0000 (15:53 +0100)
commit8596bfbafdd161f51a25bc2f6c37b87b2cddd089
tree9bbc4e925bf00ef6845eb9bdee51b3a287d2c73f
parent1fc44d494a478a179f978f6939e32e86536ef190
BUG/MINOR: stats: Init the metric variable when frontend stats are filled

In stats_fill_fe_stats(), some fields are conditionnal (ST_F_HRSP_* for
instance). But unlike unimplemented fields, for those fields, the <metric>
variable is used to fill the <stats> array, but it is not initialized. This
bug as no impact, because these fields are not used. But it is better to fix
it now to avoid future bugs.

To fix it, the metric is now defined and initialized into the for loop.

The bug was introduced by the commit 0ef54397 ("MEDIUM: stats: allow to
select one field in `stats_fill_fe_stats`"). No backport is needed except if
the above commit is backported. It fixes the issue #1063.
src/stats.c