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/command.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/command.c') diff --git a/lib/command.c b/lib/command.c index ee5a3889e8..196d73d46a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2596,9 +2596,7 @@ void cmd_terminate(void) // well graph_delete_graph(cmd_node->cmdgraph); vector_free(cmd_node->cmd_vector); - hash_clean(cmd_node->cmd_hash, NULL); - hash_free(cmd_node->cmd_hash); - cmd_node->cmd_hash = NULL; + hash_clean_and_free(&cmd_node->cmd_hash, NULL); } vector_free(cmdvec); -- cgit v1.2.3