summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-06-05 13:05:45 -0400
committerGitHub <noreply@github.com>2024-06-05 13:05:45 -0400
commit8a093592cb63568e2a29674e5109453932f7b797 (patch)
treec9414a38e3fc766aab2b16af7fc44ac4f0b81fe6
parent1df49faf538643deae764da81265b912a870767c (diff)
parentf1c19c9c0f49fbb53ff9c08e24a0e283b812a107 (diff)
Merge pull request #16167 from FRRouting/mergify/bp/stable/9.0/pr-14579
nhrpd: Fix nhrp_peer leak (backport #14579)
-rw-r--r--nhrpd/nhrp_cache.c2
-rw-r--r--nhrpd/nhrp_main.c2
-rw-r--r--nhrpd/nhrp_peer.c3
3 files changed, 5 insertions, 2 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_main.c b/nhrpd/nhrp_main.c
index 593498ca13..e401f21ed4 100644
--- a/nhrpd/nhrp_main.c
+++ b/nhrpd/nhrp_main.c
@@ -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();
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);