summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_iface.c12
-rw-r--r--pimd/pim_ifchannel.c5
2 files changed, 11 insertions, 6 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index f02cf7ed3..a807c69c6 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -85,9 +85,11 @@ static void *if_list_clean(struct pim_interface *pim_ifp)
if (pim_ifp->sec_addr_list)
list_delete_and_null(&pim_ifp->sec_addr_list);
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL)
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
+ }
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
@@ -250,9 +252,11 @@ void pim_if_delete(struct interface *ifp)
if (pim_ifp->boundary_oil_plist)
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL)
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
+ }
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 7d3b783ad..4d564e504 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -211,8 +211,9 @@ void pim_ifchannel_delete_all(struct interface *ifp)
if (!pim_ifp)
return;
- while ((ch = RB_ROOT(pim_ifchannel_rb,
- &pim_ifp->ifchannel_rb)) != NULL) {
+ while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) {
+ ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb);
+
pim_ifchannel_delete(ch);
}
}