From 5957a14329ab174e1215a914296cade8de8865e9 Mon Sep 17 00:00:00 2001 From: John Lo Date: Thu, 18 Jan 2018 12:44:50 -0500 Subject: 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 (cherry picked from commit 7f5bec647c9dc743c015d461d040e63a77fd0a08) --- src/vppinfra/hash.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/vppinfra/hash.h') 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 */ -- cgit 1.2.3-korg