From 850b2b70ac49643416c664d4326db530865f91c0 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 11 Mar 2021 16:02:46 +0100 Subject: [PATCH] nhrp: avoid crashing when terminating interface contexts avoid crashing when terminating interface contexts. Signed-off-by: Philippe Guibert --- nhrpd/nhrp_peer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index c1f615d0a9..a44190d292 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -192,10 +192,10 @@ static void *nhrp_peer_create(void *data) return p; } -static void do_peer_hash_free(struct hash_bucket *hb, - void *arg __attribute__((__unused__))) +static void do_peer_hash_free(void *hb_data) { - struct nhrp_peer *p = hb->data; + struct nhrp_peer *p = (struct nhrp_peer *)hb_data; + nhrp_peer_check_delete(p); } @@ -207,9 +207,10 @@ void nhrp_peer_interface_del(struct interface *ifp) nifp->peer_hash ? nifp->peer_hash->count : 0); if (nifp->peer_hash) { - hash_iterate(nifp->peer_hash, do_peer_hash_free, NULL); + hash_clean(nifp->peer_hash, do_peer_hash_free); assert(nifp->peer_hash->count == 0); hash_free(nifp->peer_hash); + nifp->peer_hash = NULL; } } -- 2.39.5