]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd, lib, tests, vtysh: security (cppcheck)
authorpaco <paco@voltanet.io>
Tue, 19 Jun 2018 08:40:56 +0000 (10:40 +0200)
committerpaco <paco@voltanet.io>
Tue, 19 Jun 2018 08:40:56 +0000 (10:40 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
eigrpd/eigrp_update.c
lib/frr_zmq.c
tests/lib/test_srcdest_table.c
vtysh/vtysh.c

index a3080136b5bf815fd56596915cfd0ea33ddffed3..e0142f6b326363f0f1d0f6a42f2d4e9932238233 100644 (file)
@@ -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)
index 8f190a3a09c713c42ea5bbd135520962d3962b40..3153e697faaa03f4ca29af82baf6726211ae75ae 100644 (file)
@@ -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;
        }
 
index 408f4e058199f3f95a7656d936a2ef42df213b06..04e85435d157b11a0dabf45c423e8d391cbd203e 100644 (file)
@@ -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));
index 859d126e7656d82275ca51759a5f14b3d30671c0..328c68d8265f4e40b46dc0a097374293cd2b8356 100644 (file)
@@ -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],