From fa7f21bb6b4222e5467c7cda118cb82028a71411 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 23 Mar 2022 16:35:18 +0100 Subject: stats: fix crash due to pointer taken before validate Type: fix Change-Id: Iee9eab18da142bfe0645761deea13b0fe911a43b Signed-off-by: Damjan Marion --- src/vlib/stats/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/vlib') 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++) { -- cgit 1.2.3-korg