From d8bc11a592110abdd14d11dfcb2ce623653ecab5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 21 Mar 2023 08:54:21 -0400 Subject: *: 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 --- lib/if_rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/if_rmap.c') diff --git a/lib/if_rmap.c b/lib/if_rmap.c index fa8899e9f8..27c41aaa27 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -276,7 +276,7 @@ int config_write_if_rmap(struct vty *vty, void if_rmap_ctx_delete(struct if_rmap_ctx *ctx) { listnode_delete(if_rmap_ctx_list, ctx); - hash_clean(ctx->ifrmaphash, (void (*)(void *))if_rmap_free); + hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free); if (ctx->name) XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx); XFREE(MTYPE_IF_RMAP_CTX, ctx); -- cgit v1.2.3