aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/hash.h
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-01-18 12:44:50 -0500
committerDave Wallace <dwallacelf@gmail.com>2018-01-19 16:46:03 +0000
commit5957a14329ab174e1215a914296cade8de8865e9 (patch)
tree90590a4ea5f91291e9506177468c8e347a138aa4 /src/vppinfra/hash.h
parent2167355e1657af1991085b880bb0dd0331093f4e (diff)
Sub-Interface deletion not cleanup hash's properly (VPP-1136)
On deleting sub-interfaces, functions vnet_delete_sub_interface() and vnet_delete_hw_interface() are not cleaning up sub-interface related hash tables and memory properly. Change-Id: I17c7c4b2078c062c77bfe48889beb677610035ca Signed-off-by: John Lo <loj@cisco.com> (cherry picked from commit 7f5bec647c9dc743c015d461d040e63a77fd0a08)
Diffstat (limited to 'src/vppinfra/hash.h')
-rw-r--r--src/vppinfra/hash.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vppinfra/hash.h b/src/vppinfra/hash.h
index 6206dd2a486..21986ea774c 100644
--- a/src/vppinfra/hash.h
+++ b/src/vppinfra/hash.h
@@ -294,10 +294,12 @@ always_inline void
hash_unset_mem_free (uword ** h, void *key)
{
hash_pair_t *hp = hash_get_pair_mem (*h, key);
- ASSERT (hp);
- key = uword_to_pointer (hp->key, void *);
- hash_unset_mem (*h, key);
- clib_mem_free (key);
+ if (PREDICT_TRUE (hp != NULL))
+ {
+ key = uword_to_pointer (hp->key, void *);
+ hash_unset_mem (*h, key);
+ clib_mem_free (key);
+ }
}
/* internal routine to free a hash table */