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 /zebra | |
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 'zebra')
-rw-r--r-- | zebra/interface.c | 4 | ||||
-rw-r--r-- | zebra/irdp_interface.c | 3 | ||||
-rw-r--r-- | zebra/label_manager.c | 2 | ||||
-rw-r--r-- | zebra/main.c | 2 | ||||
-rw-r--r-- | zebra/zebra_mpls.c | 4 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 2 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 2 |
7 files changed, 9 insertions, 10 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 664e493d8..9a9f76eab 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -64,7 +64,7 @@ static void zebra_if_node_destroy(route_table_delegate_t *delegate, struct route_node *node) { if (node->info) - list_delete(node->info); + list_delete_and_null((struct list **)&node->info); route_node_destroy(delegate, table, node); } @@ -627,7 +627,7 @@ static void if_delete_connected(struct interface *ifp) } /* Free chain list and respective route node. */ - list_delete(addr_list); + list_delete_and_null(&addr_list); rn->info = NULL; route_unlock_node(rn); } else if (cp.family == AF_INET6) { diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 0df03860d..8234ed6bd 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -311,8 +311,7 @@ static void irdp_if_stop(struct interface *ifp) irdp_advert_off(ifp); - list_delete(irdp->AdvPrefList); - irdp->AdvPrefList = NULL; + list_delete_and_null(&irdp->AdvPrefList); irdp->flags = 0; } diff --git a/zebra/label_manager.c b/zebra/label_manager.c index 1ed5eacd8..6fbb75178 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -375,5 +375,5 @@ int release_daemon_chunks(u_char proto, u_short instance) void label_manager_close() { - list_delete(lbl_mgr.lc_list); + list_delete_and_null(&lbl_mgr.lc_list); } diff --git a/zebra/main.c b/zebra/main.c index bf1971c47..5a2979c86 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -145,7 +145,7 @@ static void sigint(void) prefix_list_reset(); route_map_finish(); - list_delete(zebrad.client_list); + list_delete_and_null(&zebrad.client_list); work_queue_free(zebrad.ribq); if (zebrad.lsp_process_q) work_queue_free(zebrad.lsp_process_q); diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 3c7319f35..9fd07d22d 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -2701,7 +2701,7 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf, vty_out(vty, "\n"); } - list_delete(lsp_list); + list_delete_and_null(&lsp_list); } /* @@ -2740,7 +2740,7 @@ int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf) } } - list_delete(slsp_list); + list_delete_and_null(&slsp_list); return (zvrf->slsp_table->count ? 1 : 0); } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index fab8c3c93..5c3ec10a7 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1875,7 +1875,7 @@ void meta_queue_free(struct meta_queue *mq) unsigned i; for (i = 0; i < MQ_SIZE; i++) - list_delete(mq->subq[i]); + list_delete_and_null(&mq->subq[i]); XFREE(MTYPE_WORK_QUEUE, mq); } diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index a3f43f947..b704b97c5 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1587,7 +1587,7 @@ static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac) { zebra_mac_t *tmp_mac; - list_delete(mac->neigh_list); + list_delete_and_null(&mac->neigh_list); /* Free the VNI hash entry and allocated memory. */ tmp_mac = hash_release(zvni->mac_table, mac); |