diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2024-06-05 13:06:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-05 13:06:45 -0400 |
| commit | 1e56a82aeb5f025f2558e49931016534823448d9 (patch) | |
| tree | 7b2e88bfa9a7fa34881069f1bb7190b66fb594c4 | |
| parent | fe7ca5ce3edc7eedc987d091b817b1d380184f7f (diff) | |
| parent | 1975d522d5998c0cd73bdbe66e71062f0a341ca3 (diff) | |
Merge pull request #16166 from opensourcerouting/fix/backport_627fb271f0a5103141f2eccda53dd2fa08ed0819_9.1
nhrpd: Fix nhrp_peer leak
| -rw-r--r-- | nhrpd/nhrp_cache.c | 2 | ||||
| -rw-r--r-- | nhrpd/nhrp_peer.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index 1a11e0d98b..e0b8f7bf88 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -70,6 +70,8 @@ static void nhrp_cache_free(struct nhrp_cache *c) notifier_call(&c->notifier_list, NOTIFY_CACHE_DELETE); assert(!notifier_active(&c->notifier_list)); hash_release(nifp->cache_hash, c); + if (c->cur.peer) + nhrp_peer_notify_del(c->cur.peer, &c->peer_notifier); nhrp_peer_unref(c->cur.peer); nhrp_peer_unref(c->new.peer); EVENT_OFF(c->t_timeout); diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index ffb6cf7506..ef92d81436 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -45,7 +45,8 @@ static void nhrp_peer_check_delete(struct nhrp_peer *p) EVENT_OFF(p->t_fallback); EVENT_OFF(p->t_timer); - hash_release(nifp->peer_hash, p); + if (nifp->peer_hash) + hash_release(nifp->peer_hash, p); nhrp_interface_notify_del(p->ifp, &p->ifp_notifier); nhrp_vc_notify_del(p->vc, &p->vc_notifier); XFREE(MTYPE_NHRP_PEER, p); |
