Skip to content

Commit

Permalink
Merge pull request #16167 from FRRouting/mergify/bp/stable/9.0/pr-14579
Browse files Browse the repository at this point in the history
nhrpd: Fix nhrp_peer leak (backport #14579)
  • Loading branch information
donaldsharp authored Jun 5, 2024
2 parents 1df49fa + f1c19c9 commit 8a09359
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions nhrpd/nhrp_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion nhrpd/nhrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ static void nhrp_request_stop(void)
nhrp_zebra_terminate();
vici_terminate();
evmgr_terminate();
nhrp_vc_terminate();
vrf_terminate();
nhrp_vc_terminate();

debugf(NHRP_DEBUG_COMMON, "Done.");
frr_fini();
Expand Down
3 changes: 2 additions & 1 deletion nhrpd/nhrp_peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8a09359

Please sign in to comment.