summaryrefslogtreecommitdiff
path: root/lib/frrscript.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/frrscript.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/frrscript.c')
-rw-r--r--lib/frrscript.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/frrscript.c b/lib/frrscript.c
index 4248a45002..1b99c7e2c6 100644
--- a/lib/frrscript.c
+++ b/lib/frrscript.c
@@ -398,8 +398,7 @@ fail:
void frrscript_delete(struct frrscript *fs)
{
- hash_clean(fs->lua_function_hash, lua_function_free);
- hash_free(fs->lua_function_hash);
+ hash_clean_and_free(&fs->lua_function_hash, lua_function_free);
XFREE(MTYPE_SCRIPT, fs->name);
XFREE(MTYPE_SCRIPT, fs);
}
@@ -417,8 +416,7 @@ void frrscript_init(const char *sd)
void frrscript_fini(void)
{
- hash_clean(codec_hash, codec_free);
- hash_free(codec_hash);
+ hash_clean_and_free(&codec_hash, codec_free);
frrscript_names_destroy();
}