aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/init.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-23 16:35:18 +0100
committerDamjan Marion <damarion@cisco.com>2022-03-23 16:38:56 +0100
commitfa7f21bb6b4222e5467c7cda118cb82028a71411 (patch)
tree3c3cfc96c8db712c98e6c3f514e23b5a247e8252 /src/vlib/stats/init.c
parent2e7c5d33cc9dd7a79a0420d60b55169b620cc0c3 (diff)
stats: fix crash due to pointer taken before validate
Type: fix Change-Id: Iee9eab18da142bfe0645761deea13b0fe911a43b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/stats/init.c')
-rw-r--r--src/vlib/stats/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vlib/stats/init.c b/src/vlib/stats/init.c
index 3dba1022b52..3cfbd2dbd66 100644
--- a/src/vlib/stats/init.c
+++ b/src/vlib/stats/init.c
@@ -12,12 +12,14 @@ static void
vector_rate_collector_fn (vlib_stats_collector_data_t *d)
{
vlib_main_t *this_vlib_main;
- counter_t **counters = d->entry->data;
- counter_t *cb = counters[0];
+ counter_t **counters;
+ counter_t *cb;
f64 vector_rate = 0.0;
u32 i, n_threads = vlib_get_n_threads ();
vlib_stats_validate (d->entry_index, 0, n_threads - 1);
+ counters = d->entry->data;
+ cb = counters[0];
for (i = 0; i < n_threads; i++)
{