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/ferr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/ferr.c') diff --git a/lib/ferr.c b/lib/ferr.c index 5998befec2..33bcb075fa 100644 --- a/lib/ferr.c +++ b/lib/ferr.c @@ -180,9 +180,7 @@ void log_ref_init(void) void log_ref_fini(void) { frr_with_mutex (&refs_mtx) { - hash_clean(refs, NULL); - hash_free(refs); - refs = NULL; + hash_clean_and_free(&refs, NULL); } } -- cgit v1.2.3