diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-10-06 22:50:19 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-10-06 22:50:19 +0200 |
commit | 11bf8e13f2034634601ba1fb43114164e71c71fe (patch) | |
tree | 91a7324c8d3a96c2a10254f6f91ac99b50b43d2f /ldpd | |
parent | Merge pull request #1295 from donaldsharp/more_1270 (diff) | |
download | frr-11bf8e13f2034634601ba1fb43114164e71c71fe.tar.xz frr-11bf8e13f2034634601ba1fb43114164e71c71fe.zip |
ldpd: sprinkle in some asserts to make scan-build happy
While here, fix the other SA warnings.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/address.c | 3 | ||||
-rw-r--r-- | ldpd/interface.c | 1 | ||||
-rw-r--r-- | ldpd/labelmapping.c | 2 | ||||
-rw-r--r-- | ldpd/lde.c | 2 | ||||
-rw-r--r-- | ldpd/lde_lib.c | 4 | ||||
-rw-r--r-- | ldpd/ldpd.c | 1 | ||||
-rw-r--r-- | ldpd/ldpe.c | 4 |
7 files changed, 12 insertions, 5 deletions
diff --git a/ldpd/address.c b/ldpd/address.c index 18ab03776..12356a0b4 100644 --- a/ldpd/address.c +++ b/ldpd/address.c @@ -98,6 +98,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list, log_msg_address(1, msg_type, nbr, af, &if_addr->addr); LIST_REMOVE(if_addr, entry); + assert(if_addr != LIST_FIRST(addr_list)); free(if_addr); if (--tlv_addr_count == 0) break; @@ -168,7 +169,6 @@ send_mac_withdrawal(struct nbr *nbr, struct map *fec, uint8_t *mac) err = gen_ldp_hdr(buf, size); size -= LDP_HDR_SIZE; err |= gen_msg_hdr(buf, MSG_TYPE_ADDRWITHDRAW, size); - size -= LDP_MSG_SIZE; err |= gen_address_list_tlv(buf, AF_INET, NULL, 0); err |= gen_fec_tlv(buf, fec); err |= gen_mac_list_tlv(buf, mac); @@ -400,6 +400,7 @@ address_list_clr(struct if_addr_head *addr_list) while ((if_addr = LIST_FIRST(addr_list)) != NULL) { LIST_REMOVE(if_addr, entry); + assert(if_addr != LIST_FIRST(addr_list)); free(if_addr); } } diff --git a/ldpd/interface.c b/ldpd/interface.c index a18019c0c..bbcea9f55 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -103,6 +103,7 @@ ldpe_if_exit(struct iface *iface) while ((if_addr = LIST_FIRST(&iface->addr_list)) != NULL) { LIST_REMOVE(if_addr, entry); + assert(if_addr != LIST_FIRST(&iface->addr_list)); free(if_addr); } } diff --git a/ldpd/labelmapping.c b/ldpd/labelmapping.c index f53bc8333..5662038a5 100644 --- a/ldpd/labelmapping.c +++ b/ldpd/labelmapping.c @@ -130,6 +130,7 @@ send_labelmessage(struct nbr *nbr, uint16_t type, struct mapping_head *mh) } TAILQ_REMOVE(mh, me, entry); + assert(me != TAILQ_FIRST(mh)); free(me); } @@ -459,6 +460,7 @@ recv_labelmessage(struct nbr *nbr, char *buf, uint16_t len, uint16_t type) next: TAILQ_REMOVE(&mh, me, entry); + assert(me != TAILQ_FIRST(&mh)); free(me); } diff --git a/ldpd/lde.c b/ldpd/lde.c index 3482f3d72..648eefa65 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -429,7 +429,7 @@ lde_dispatch_parent(struct thread *thread) struct imsg imsg; struct kif *kif; struct kroute *kr; - int fd = THREAD_FD(thread); + int fd; struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; ssize_t n; diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index c56b7e33d..18c8c0a12 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -229,8 +229,10 @@ fec_free(void *arg) struct fec_node *fn = arg; struct fec_nh *fnh; - while ((fnh = LIST_FIRST(&fn->nexthops))) + while ((fnh = LIST_FIRST(&fn->nexthops))) { fec_nh_del(fnh); + assert(fnh != LIST_FIRST(&fn->nexthops)); + } if (!RB_EMPTY(lde_map_head, &fn->downstream)) log_warnx("%s: fec %s downstream list not empty", __func__, log_fec(&fn->fec)); diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 843d160d6..12aeb1fff 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -260,7 +260,6 @@ main(int argc, char *argv[]) sizeof(init.zclient_serv_path)); argc -= optind; - argv += optind; if (argc > 0 || (lflag && eflag)) frr_help_exit(1); diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 1c0a8bdc8..3c8f8135e 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -215,6 +215,7 @@ ldpe_shutdown(void) /* remove addresses from global list */ while ((if_addr = LIST_FIRST(&global.addr_list)) != NULL) { LIST_REMOVE(if_addr, entry); + assert(if_addr != LIST_FIRST(&global.addr_list)); free(if_addr); } while ((adj = RB_ROOT(global_adj_head, &global.adj_tree)) != NULL) @@ -265,7 +266,7 @@ ldpe_dispatch_main(struct thread *thread) struct l2vpn_if *lif, *nlif; struct l2vpn_pw *pw, *npw; struct imsg imsg; - int fd = THREAD_FD(thread); + int fd; struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct iface *iface = NULL; @@ -964,6 +965,7 @@ mapping_list_clr(struct mapping_head *mh) while ((me = TAILQ_FIRST(mh)) != NULL) { TAILQ_REMOVE(mh, me, entry); + assert(me != TAILQ_FIRST(mh)); free(me); } } |