stats: fix crash due to pointer taken before validate
Type: fix
Change-Id: Iee9eab18da142bfe0645761deea13b0fe911a43b
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/stats/init.c b/src/vlib/stats/init.c
index 3dba102..3cfbd2d 100644
--- a/src/vlib/stats/init.c
+++ b/src/vlib/stats/init.c
@@ -12,12 +12,14 @@
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++)
{