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 /ospfd/ospf_ism.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 'ospfd/ospf_ism.c')
-rw-r--r-- | ospfd/ospf_ism.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index f223a870d..25ab9cbe0 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -104,7 +104,7 @@ static struct ospf_neighbor *ospf_elect_dr(struct ospf_interface *oi, else DR(oi).s_addr = 0; - list_delete(dr_list); + list_delete_and_null(&dr_list); return dr; } @@ -144,8 +144,8 @@ static struct ospf_neighbor *ospf_elect_bdr(struct ospf_interface *oi, else BDR(oi).s_addr = 0; - list_delete(bdr_list); - list_delete(no_dr_list); + list_delete_and_null(&bdr_list); + list_delete_and_null(&no_dr_list); return bdr; } @@ -232,7 +232,7 @@ static int ospf_dr_election(struct ospf_interface *oi) zlog_debug("DR-Election[2nd]: DR %s", inet_ntoa(DR(oi))); } - list_delete(el_list); + list_delete_and_null(&el_list); /* if DR or BDR changes, cause AdjOK? neighbor event. */ if (!IPV4_ADDR_SAME(&old_dr, &DR(oi)) |