diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2021-03-11 16:02:46 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-12 19:23:57 +0200 |
| commit | 850b2b70ac49643416c664d4326db530865f91c0 (patch) | |
| tree | 9d551de81c32b98e39548bd08a61b3d2a77ca9fe | |
| parent | f468a45af26433c70f61ff4df1c6dd30c551cbc5 (diff) | |
nhrp: avoid crashing when terminating interface contexts
avoid crashing when terminating interface contexts.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| -rw-r--r-- | nhrpd/nhrp_peer.c | 9 |
1 files 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; } } |
