summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-09-28 03:19:20 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-10-05 16:53:17 +0200
commitacdf5e25101bafe334e6b500c3dd0a2babb3c1ec (patch)
treed8b9483a3aeebc7e90ddbe5f765e5e63aecb8e1b /bgpd
parent*: Convert list_delete(struct list *) to ** to allow nulling (diff)
downloadfrr-acdf5e25101bafe334e6b500c3dd0a2babb3c1ec.tar.xz
frr-acdf5e25101bafe334e6b500c3dd0a2babb3c1ec.zip
*: Convert list_free usage to list_delete
list_free is occassionally being used to delete the list and accidently not deleting all the nodes. We keep running across this usage pattern. Let's remove the temptation and only allow list_delete to handle list deletion. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_evpn.c2
-rw-r--r--bgpd/bgp_zebra.c6
-rw-r--r--bgpd/bgpd.c3
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c2
4 files changed, 5 insertions, 8 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index f5c0fd601..a09d966d7 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -288,7 +288,7 @@ static void unmap_vni_from_rt(struct bgp *bgp, struct bgpevpn *vpn,
/* Delete VNI from hash list for this RT. */
listnode_delete(irt->vnis, vpn);
if (!listnode_head(irt->vnis)) {
- list_free(irt->vnis);
+ list_delete_and_null(&irt->vnis);
import_rt_free(bgp, irt);
}
}
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index bc69b67de..c90257d65 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1290,10 +1290,8 @@ static void bgp_redist_del(struct bgp *bgp, afi_t afi, u_char type,
if (red) {
listnode_delete(bgp->redist[afi][type], red);
XFREE(MTYPE_BGP_REDIST, red);
- if (!bgp->redist[afi][type]->count) {
- list_free(bgp->redist[afi][type]);
- bgp->redist[afi][type] = NULL;
- }
+ if (!bgp->redist[afi][type]->count)
+ list_delete_and_null(&bgp->redist[afi][type]);
}
}
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 28f0b14d3..308698e1c 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7454,8 +7454,7 @@ void bgp_terminate(void)
/* reverse bgp_master_init */
bgp_close();
if (bm->listen_sockets)
- list_free(bm->listen_sockets);
- bm->listen_sockets = NULL;
+ list_delete_and_null(&bm->listen_sockets);
for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp))
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer))
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index b699cec9e..75347a7ee 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -1544,7 +1544,7 @@ void vnc_direct_bgp_vpn_disable(struct bgp *bgp, afi_t afi)
if (nve_list) {
vnc_direct_bgp_unexport_table(
afi, it->imported_vpn[afi], nve_list);
- list_free(nve_list);
+ list_delete_and_null(&nve_list);
}
}
}