summaryrefslogtreecommitdiff
path: root/lib/vrf.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-03-21 08:54:21 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-03-21 08:54:21 -0400
commitd8bc11a592110abdd14d11dfcb2ce623653ecab5 (patch)
treeeee3628586497e48192f65326316f0eb91114011 /lib/vrf.c
parent2e1ea892220dccb8a4c72e438cb3bbd4cac22b2b (diff)
*: Add a hash_clean_and_free() function
Add a hash_clean_and_free() function as well as convert the code to use it. This function also takes a double pointer to the hash to set it NULL. Also it cleanly does nothing if the pointer is NULL( as a bunch of code tested for ). Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/vrf.c')
-rw-r--r--lib/vrf.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index a60f532f41..73f5d8ff72 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -394,11 +394,7 @@ void vrf_bitmap_free(vrf_bitmap_t bmap)
{
struct hash *vrf_hash = bmap;
- if (vrf_hash == NULL)
- return;
-
- hash_clean(vrf_hash, vrf_hash_bitmap_free);
- hash_free(vrf_hash);
+ hash_clean_and_free(&vrf_hash, vrf_hash_bitmap_free);
}
void vrf_bitmap_set(vrf_bitmap_t bmap, vrf_id_t vrf_id)