vlib: Counter free needs to NULL the allocated counter vector

otherwise the next time the counter is validated this is dangling.

Type: fix
Fixes: 58fd481d73

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ifa8d5ff27175cf6dfb30cbf023fa3251fe5c780e
This commit is contained in:
Neale Ranns
2022-10-13 05:39:11 +00:00
committed by Ole Tr�an
parent 368dab3699
commit 80c0ae2437
2 changed files with 14 additions and 2 deletions

View File

@ -89,6 +89,9 @@ test_simple_counter_expand (vlib_main_t *vm)
epoch = new_epoch;
}
vlib_free_simple_counter (&counter);
vlib_validate_simple_counter (&counter, 0);
return 0;
}
@ -136,6 +139,9 @@ test_combined_counter_expand (vlib_main_t *vm)
epoch = new_epoch;
}
vlib_free_combined_counter (&counter);
vlib_validate_combined_counter (&counter, 0);
return 0;
}

View File

@ -108,7 +108,10 @@ vlib_free_simple_counter (vlib_simple_counter_main_t * cm)
vec_free (cm->counters);
}
else
vlib_stats_remove_entry (cm->stats_entry_index);
{
vlib_stats_remove_entry (cm->stats_entry_index);
cm->counters = NULL;
}
}
void
@ -176,7 +179,10 @@ vlib_free_combined_counter (vlib_combined_counter_main_t * cm)
vec_free (cm->counters);
}
else
vlib_stats_remove_entry (cm->stats_entry_index);
{
vlib_stats_remove_entry (cm->stats_entry_index);
cm->counters = NULL;
}
}
u32