Skip to content

Commit 1e56a82

Browse files
authored
Merge pull request #16166 from opensourcerouting/fix/backport_627fb271f0a5103141f2eccda53dd2fa08ed0819_9.1
nhrpd: Fix nhrp_peer leak
2 parents fe7ca5c + 1975d52 commit 1e56a82

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

nhrpd/nhrp_cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ static void nhrp_cache_free(struct nhrp_cache *c)
7070
notifier_call(&c->notifier_list, NOTIFY_CACHE_DELETE);
7171
assert(!notifier_active(&c->notifier_list));
7272
hash_release(nifp->cache_hash, c);
73+
if (c->cur.peer)
74+
nhrp_peer_notify_del(c->cur.peer, &c->peer_notifier);
7375
nhrp_peer_unref(c->cur.peer);
7476
nhrp_peer_unref(c->new.peer);
7577
EVENT_OFF(c->t_timeout);

nhrpd/nhrp_peer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ static void nhrp_peer_check_delete(struct nhrp_peer *p)
4545

4646
EVENT_OFF(p->t_fallback);
4747
EVENT_OFF(p->t_timer);
48-
hash_release(nifp->peer_hash, p);
48+
if (nifp->peer_hash)
49+
hash_release(nifp->peer_hash, p);
4950
nhrp_interface_notify_del(p->ifp, &p->ifp_notifier);
5051
nhrp_vc_notify_del(p->vc, &p->vc_notifier);
5152
XFREE(MTYPE_NHRP_PEER, p);

0 commit comments

Comments
 (0)