diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-05 16:51:01 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-05 16:53:13 +0200 |
commit | affe9e99831408960b8b6f8477506ed2874a05dd (patch) | |
tree | a6f2f7a898fad5fcdc3f74b233095b6e8f6a2b46 /pimd/pim_iface.c | |
parent | Merge pull request #1244 from donaldsharp/flush_routes (diff) | |
download | frr-affe9e99831408960b8b6f8477506ed2874a05dd.tar.xz frr-affe9e99831408960b8b6f8477506ed2874a05dd.zip |
*: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **. This is to allow the list pointer to be nulled.
I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.
Let's make the api explicit in it setting the list pointer
to null.
Cynical Prediction: This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_iface.c')
-rw-r--r-- | pimd/pim_iface.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index b8cbed7f9..878714502 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -71,19 +71,19 @@ static void *if_list_clean(struct pim_interface *pim_ifp) struct pim_ifchannel *ch; if (pim_ifp->igmp_join_list) - list_delete(pim_ifp->igmp_join_list); + list_delete_and_null(&pim_ifp->igmp_join_list); if (pim_ifp->igmp_socket_list) - list_delete(pim_ifp->igmp_socket_list); + list_delete_and_null(&pim_ifp->igmp_socket_list); if (pim_ifp->pim_neighbor_list) - list_delete(pim_ifp->pim_neighbor_list); + list_delete_and_null(&pim_ifp->pim_neighbor_list); if (pim_ifp->upstream_switch_list) - list_delete(pim_ifp->upstream_switch_list); + list_delete_and_null(&pim_ifp->upstream_switch_list); if (pim_ifp->sec_addr_list) - list_delete(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) @@ -241,10 +241,10 @@ void pim_if_delete(struct interface *ifp) pim_if_del_vif(ifp); - list_delete(pim_ifp->igmp_socket_list); - list_delete(pim_ifp->pim_neighbor_list); - list_delete(pim_ifp->upstream_switch_list); - list_delete(pim_ifp->sec_addr_list); + list_delete_and_null(&pim_ifp->igmp_socket_list); + list_delete_and_null(&pim_ifp->pim_neighbor_list); + list_delete_and_null(&pim_ifp->upstream_switch_list); + list_delete_and_null(&pim_ifp->sec_addr_list); if (pim_ifp->boundary_oil_plist) XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); @@ -1373,7 +1373,7 @@ int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr, listnode_delete(pim_ifp->igmp_join_list, ij); igmp_join_free(ij); if (listcount(pim_ifp->igmp_join_list) < 1) { - list_delete(pim_ifp->igmp_join_list); + list_delete_and_null(&pim_ifp->igmp_join_list); pim_ifp->igmp_join_list = 0; } |