summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-04-08 22:12:18 -0500
committerGitHub <noreply@github.com>2025-04-08 22:12:18 -0500
commit3f30c3e524327be76c7fd4282ea34ea73f8564b7 (patch)
tree04355a42765c023d8ca6a6cb1cb1b7ead448115a
parent42cc81f57d3d7d2f0bdc4d776d8fe0b985990e39 (diff)
parent8cee019393292eb3d5f0767c08a4acbbd3e7236a (diff)
Merge pull request #18612 from FRRouting/mergify/bp/stable/10.3/pr-18526
pimd: Fix memory leak on shutdown (backport #18526)
-rw-r--r--pimd/pim_iface.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 6c97ba5237..f1138dfa3e 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -193,8 +193,17 @@ void pim_if_delete(struct interface *ifp)
assert(pim_ifp);
pim_ifp->pim->mcast_if_count--;
- if (pim_ifp->gm_join_list)
+ if (pim_ifp->gm_join_list) {
pim_if_gm_join_del_all(ifp);
+ /*
+ * Sometimes gm_join_del_all does not delete them all
+ * and as such it's not actually freed. Let's
+ * just clean this up if it wasn't to prevent
+ * the problem.
+ */
+ if (pim_ifp->gm_join_list)
+ list_delete(&pim_ifp->gm_join_list);
+ }
if (pim_ifp->static_group_list)
pim_if_static_group_del_all(ifp);
@@ -1434,10 +1443,8 @@ int pim_if_gm_join_del(struct interface *ifp, pim_addr group_addr,
}
listnode_delete(pim_ifp->gm_join_list, ij);
gm_join_free(ij);
- if (listcount(pim_ifp->gm_join_list) < 1) {
+ if (listcount(pim_ifp->gm_join_list) < 1)
list_delete(&pim_ifp->gm_join_list);
- pim_ifp->gm_join_list = 0;
- }
return 0;
}