From 6d10727ac13e5b80c3d5f8b42acf17cebb3f9d5a Mon Sep 17 00:00:00 2001 From: paco Date: Tue, 19 Jun 2018 10:40:56 +0200 Subject: [PATCH] eigrpd, lib, tests, vtysh: security (cppcheck) Signed-off-by: F. Aragon --- eigrpd/eigrp_update.c | 1 - lib/frr_zmq.c | 6 ++++-- tests/lib/test_srcdest_table.c | 4 +--- vtysh/vtysh.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index a3080136b5..e0142f6b32 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -757,7 +757,6 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) prefixes = nbr->nbr_gr_prefixes_send; send_prefixes = 0; - length = EIGRP_HEADER_LEN; /* if there already were last packet chunk, we won't continue */ if (nbr->nbr_gr_packet_type == EIGRP_PACKET_PART_LAST) diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index 8f190a3a09..3153e697fa 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -174,9 +174,10 @@ int funcname_frrzmq_thread_add_read(struct thread_master *master, cb = *cbp; else { cb = XCALLOC(MTYPE_ZEROMQ_CB, sizeof(struct frrzmq_cb)); - cb->write.cancelled = 1; if (!cb) return -1; + + cb->write.cancelled = 1; *cbp = cb; } @@ -282,9 +283,10 @@ int funcname_frrzmq_thread_add_write(struct thread_master *master, cb = *cbp; else { cb = XCALLOC(MTYPE_ZEROMQ_CB, sizeof(struct frrzmq_cb)); - cb->read.cancelled = 1; if (!cb) return -1; + + cb->read.cancelled = 1; *cbp = cb; } diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c index 408f4e0581..04e85435d1 100644 --- a/tests/lib/test_srcdest_table.c +++ b/tests/lib/test_srcdest_table.c @@ -104,9 +104,7 @@ static unsigned int log_key(void *data) static int log_cmp(const void *a, const void *b) { - if (a == NULL && b != NULL) - return 0; - if (b == NULL && a != NULL) + if (a == NULL || b == NULL) return 0; return !memcmp(a, b, 2 * sizeof(struct prefix)); diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 859d126e76..328c68d826 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -816,7 +816,7 @@ int vtysh_mark_file(const char *filename) vty_out(vty, "%s", vty->buf); break; case CMD_SUCCESS_DAEMON: { - int cmd_stat = CMD_SUCCESS; + int cmd_stat; vty_out(vty, "%s", vty->buf); cmd_stat = vtysh_client_execute(&vtysh_client[0], -- 2.39.5