summaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/ip6
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-10-28 10:16:09 +0200
committerDamjan Marion <dmarion@me.com>2021-10-28 10:58:13 +0000
commit9f4e5d8e512e1d41b8735c1227282d713f50466d (patch)
tree22eec60e059588598675897ed21f9f14b92e5b36 /src/plugins/ioam/ip6
parentc3225ddf8a3db9ee0f0d6edb7d82717d8cf20b36 (diff)
ioam: fix coverity warning/NULL dereference
Add a NULL check and missing array index to avoid multiple NULL derefences. Runnning: set ioam ip6 sr-tunnel-select disable on a fresh VPP no longer crashes. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Ia85f92024f3b14ef1c4cdb9fcf794b962cad9422
Diffstat (limited to 'src/plugins/ioam/ip6')
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h
index b85172e8ac1..8c1b6291707 100644
--- a/src/plugins/ioam/ip6/ioam_cache.h
+++ b/src/plugins/ioam/ip6/ioam_cache.h
@@ -608,17 +608,20 @@ ioam_cache_ts_table_destroy (vlib_main_t * vm)
int i;
/* free pool and hash table */
- for (i = 0; i < no_of_threads; i++)
+ if (cm->ioam_ts_pool)
{
- pool_foreach (entry, cm->ioam_ts_pool[i])
- {
- ioam_cache_ts_entry_free (i, entry, cm->error_node_index);
- }
- pool_free (cm->ioam_ts_pool[i]);
- cm->ioam_ts_pool = 0;
- tw_timer_wheel_free_16t_2w_512sl (&cm->timer_wheels[i]);
+ for (i = 0; i < no_of_threads; i++)
+ {
+ pool_foreach (entry, cm->ioam_ts_pool[i])
+ {
+ ioam_cache_ts_entry_free (i, entry, cm->error_node_index);
+ }
+ pool_free (cm->ioam_ts_pool[i]);
+ cm->ioam_ts_pool[i] = 0;
+ tw_timer_wheel_free_16t_2w_512sl (&cm->timer_wheels[i]);
+ }
+ vec_free (cm->ioam_ts_pool);
}
- vec_free (cm->ioam_ts_pool);
return (0);
}