Skip to content

Commit 8a09359

Browse files
authored
Merge pull request #16167 from FRRouting/mergify/bp/stable/9.0/pr-14579
nhrpd: Fix nhrp_peer leak (backport #14579)
2 parents 1df49fa + f1c19c9 commit 8a09359

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
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_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ static void nhrp_request_stop(void)
8888
nhrp_zebra_terminate();
8989
vici_terminate();
9090
evmgr_terminate();
91-
nhrp_vc_terminate();
9291
vrf_terminate();
92+
nhrp_vc_terminate();
9393

9494
debugf(NHRP_DEBUG_COMMON, "Done.");
9595
frr_fini();

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)