diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2023-03-21 08:54:21 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2023-03-21 08:54:21 -0400 |
| commit | d8bc11a592110abdd14d11dfcb2ce623653ecab5 (patch) | |
| tree | eee3628586497e48192f65326316f0eb91114011 /nhrpd | |
| parent | 2e1ea892220dccb8a4c72e438cb3bbd4cac22b2b (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 'nhrpd')
| -rw-r--r-- | nhrpd/nhrp_peer.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 0c9d5ade37..9b92cdffc3 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -201,12 +201,7 @@ void nhrp_peer_interface_del(struct interface *ifp) debugf(NHRP_DEBUG_COMMON, "Cleaning up undeleted peer entries (%lu)", nifp->peer_hash ? nifp->peer_hash->count : 0); - if (nifp->peer_hash) { - hash_clean(nifp->peer_hash, do_peer_hash_free); - assert(nifp->peer_hash->count == 0); - hash_free(nifp->peer_hash); - nifp->peer_hash = NULL; - } + hash_clean_and_free(&nifp->peer_hash, do_peer_hash_free); } struct nhrp_peer *nhrp_peer_get(struct interface *ifp, |
