summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/bihash_template.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-08-06 12:03:11 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-08-10 22:55:20 +0000
commita8c720e301f3576506b2b284fe925b055398b638 (patch)
tree491d9504b3ece4d5e5c5ba72ab58473246212f8f /src/vppinfra/bihash_template.c
parent384bd33e0481a6d4805ee55ec6a7f4809a40b695 (diff)
vppinfra: Fix bihash del warning
Type: fix When freeing an uninstantiated bihash created with dont_add_to_all_bihash_list = 1 we get a warning. This removes the warning & the search for the bihash on cleanup. Change-Id: Iac50ce7e30b97925768f7ad3cb1d30af14686e21 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vppinfra/bihash_template.c')
-rw-r--r--src/vppinfra/bihash_template.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c
index ddaccbdb126..a6fa6267c79 100644
--- a/src/vppinfra/bihash_template.c
+++ b/src/vppinfra/bihash_template.c
@@ -201,6 +201,7 @@ void BV (clib_bihash_init2) (BVT (clib_bihash_init2_args) * a)
h->log2_nbuckets = max_log2 (a->nbuckets);
h->memory_size = BIHASH_USE_HEAP ? 0 : a->memory_size;
h->instantiated = 0;
+ h->dont_add_to_all_bihash_list = a->dont_add_to_all_bihash_list;
h->fmt_fn = BV (format_bihash);
h->kvp_fmt_fn = a->kvp_fmt_fn;
@@ -435,6 +436,11 @@ void BV (clib_bihash_free) (BVT (clib_bihash) * h)
clib_mem_vm_free ((void *) (uword) (alloc_arena (h)),
alloc_arena_size (h));
never_initialized:
+ if (h->dont_add_to_all_bihash_list)
+ {
+ clib_memset_u8 (h, 0, sizeof (*h));
+ return;
+ }
clib_memset_u8 (h, 0, sizeof (*h));
for (i = 0; i < vec_len (clib_all_bihashes); i++)
{