summaryrefslogtreecommitdiff
path: root/bgpd/bgp_lcommunity.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 /bgpd/bgp_lcommunity.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 'bgpd/bgp_lcommunity.c')
-rw-r--r--bgpd/bgp_lcommunity.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 2329bcb6c6..15bf419868 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -334,9 +334,7 @@ void lcommunity_init(void)
void lcommunity_finish(void)
{
- hash_clean(lcomhash, (void (*)(void *))lcommunity_hash_free);
- hash_free(lcomhash);
- lcomhash = NULL;
+ hash_clean_and_free(&lcomhash, (void (*)(void *))lcommunity_hash_free);
}
/* Get next Large Communities token from the string.