diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-03-26 22:32:12 +0100 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-03-26 22:32:12 +0100 |
commit | 33054bb2a8d6272e2f137e8be1833ff9e469c177 (patch) | |
tree | c78739fcf778dc56540877d255ae25766255a672 /src/transport | |
parent | 040ebbd2039e5ae0ba93ad3b7976721088ff6294 (diff) | |
download | gnunet-33054bb2a8d6272e2f137e8be1833ff9e469c177.tar.gz gnunet-33054bb2a8d6272e2f137e8be1833ff9e469c177.zip |
-more coverity fixes
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-communicator-tcp.c | 48 | ||||
-rw-r--r-- | src/transport/gnunet-communicator-udp.c | 13 | ||||
-rw-r--r-- | src/transport/gnunet-service-tng.c | 6 | ||||
-rw-r--r-- | src/transport/transport-testing-communicator.c | 5 |
4 files changed, 39 insertions, 33 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index c8a4c0375..9dd2797df 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -877,12 +877,14 @@ queue_destroy (struct Queue *queue) | |||
877 | { | 877 | { |
878 | struct ListenTask *lt = NULL; | 878 | struct ListenTask *lt = NULL; |
879 | struct GNUNET_HashCode h_sock; | 879 | struct GNUNET_HashCode h_sock; |
880 | int sockfd; | ||
880 | 881 | ||
881 | GNUNET_CRYPTO_hash (queue->listen_sock, | 882 | sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); |
882 | sizeof(queue->listen_sock), | 883 | GNUNET_CRYPTO_hash (&sockfd, |
884 | sizeof(int), | ||
883 | &h_sock); | 885 | &h_sock); |
884 | 886 | ||
885 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); | 887 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); |
886 | 888 | ||
887 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 889 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
888 | "Disconnecting queue for peer `%s'\n", | 890 | "Disconnecting queue for peer `%s'\n", |
@@ -1263,7 +1265,8 @@ rekey_monotime_cb (void *cls, | |||
1263 | pid, | 1265 | pid, |
1264 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY, | 1266 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY, |
1265 | rekey_monotonic_time, | 1267 | rekey_monotonic_time, |
1266 | sizeof(rekey_monotonic_time), | 1268 | sizeof(* |
1269 | rekey_monotonic_time), | ||
1267 | GNUNET_TIME_UNIT_FOREVER_ABS, | 1270 | GNUNET_TIME_UNIT_FOREVER_ABS, |
1268 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1271 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1269 | &rekey_monotime_store_cb, | 1272 | &rekey_monotime_store_cb, |
@@ -1413,18 +1416,18 @@ handshake_ack_monotime_cb (void *cls, | |||
1413 | queue_finish (queue); | 1416 | queue_finish (queue); |
1414 | return; | 1417 | return; |
1415 | } | 1418 | } |
1416 | queue->handshake_ack_monotime_sc = GNUNET_PEERSTORE_store (peerstore, | 1419 | queue->handshake_ack_monotime_sc = |
1417 | "transport_tcp_communicator", | 1420 | GNUNET_PEERSTORE_store (peerstore, |
1418 | pid, | 1421 | "transport_tcp_communicator", |
1419 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, | 1422 | pid, |
1420 | handshake_ack_monotonic_time, | 1423 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, |
1421 | sizeof( | 1424 | handshake_ack_monotonic_time, |
1422 | handshake_ack_monotonic_time), | 1425 | sizeof(*handshake_ack_monotonic_time), |
1423 | GNUNET_TIME_UNIT_FOREVER_ABS, | 1426 | GNUNET_TIME_UNIT_FOREVER_ABS, |
1424 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1427 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1425 | & | 1428 | & |
1426 | handshake_ack_monotime_store_cb, | 1429 | handshake_ack_monotime_store_cb, |
1427 | queue); | 1430 | queue); |
1428 | } | 1431 | } |
1429 | 1432 | ||
1430 | 1433 | ||
@@ -3255,6 +3258,7 @@ init_socket (struct sockaddr *addr, | |||
3255 | socklen_t sto_len; | 3258 | socklen_t sto_len; |
3256 | struct GNUNET_NETWORK_Handle *listen_sock; | 3259 | struct GNUNET_NETWORK_Handle *listen_sock; |
3257 | struct ListenTask *lt; | 3260 | struct ListenTask *lt; |
3261 | int sockfd; | ||
3258 | struct GNUNET_HashCode h_sock; | 3262 | struct GNUNET_HashCode h_sock; |
3259 | 3263 | ||
3260 | if (NULL == addr) | 3264 | if (NULL == addr) |
@@ -3343,8 +3347,9 @@ init_socket (struct sockaddr *addr, | |||
3343 | 3347 | ||
3344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3345 | "creating hash\n"); | 3349 | "creating hash\n"); |
3346 | GNUNET_CRYPTO_hash (lt->listen_sock, | 3350 | sockfd = GNUNET_NETWORK_get_fd (lt->listen_sock); |
3347 | sizeof(lt->listen_sock), | 3351 | GNUNET_CRYPTO_hash (&sockfd, |
3352 | sizeof(int), | ||
3348 | &h_sock); | 3353 | &h_sock); |
3349 | 3354 | ||
3350 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3355 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3564,6 +3569,7 @@ run (void *cls, | |||
3564 | peerstore = GNUNET_PEERSTORE_connect (cfg); | 3569 | peerstore = GNUNET_PEERSTORE_connect (cfg); |
3565 | if (NULL == peerstore) | 3570 | if (NULL == peerstore) |
3566 | { | 3571 | { |
3572 | GNUNET_free (bindto); | ||
3567 | GNUNET_break (0); | 3573 | GNUNET_break (0); |
3568 | GNUNET_SCHEDULER_shutdown (); | 3574 | GNUNET_SCHEDULER_shutdown (); |
3569 | return; | 3575 | return; |
@@ -3596,7 +3602,6 @@ run (void *cls, | |||
3596 | GNUNET_free (po); | 3602 | GNUNET_free (po); |
3597 | nat_register (); | 3603 | nat_register (); |
3598 | GNUNET_free (bindto); | 3604 | GNUNET_free (bindto); |
3599 | |||
3600 | return; | 3605 | return; |
3601 | } | 3606 | } |
3602 | 3607 | ||
@@ -3609,8 +3614,8 @@ run (void *cls, | |||
3609 | in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port); | 3614 | in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port); |
3610 | init_socket (in, in_len); | 3615 | init_socket (in, in_len); |
3611 | nat_register (); | 3616 | nat_register (); |
3617 | GNUNET_free (start); | ||
3612 | GNUNET_free (bindto); | 3618 | GNUNET_free (bindto); |
3613 | |||
3614 | return; | 3619 | return; |
3615 | } | 3620 | } |
3616 | 3621 | ||
@@ -3620,8 +3625,8 @@ run (void *cls, | |||
3620 | in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port); | 3625 | in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port); |
3621 | init_socket (in, in_len); | 3626 | init_socket (in, in_len); |
3622 | nat_register (); | 3627 | nat_register (); |
3628 | GNUNET_free (start); | ||
3623 | GNUNET_free (bindto); | 3629 | GNUNET_free (bindto); |
3624 | |||
3625 | return; | 3630 | return; |
3626 | } | 3631 | } |
3627 | 3632 | ||
@@ -3635,6 +3640,7 @@ run (void *cls, | |||
3635 | &init_socket_resolv, | 3640 | &init_socket_resolv, |
3636 | &port); | 3641 | &port); |
3637 | GNUNET_free (bindto); | 3642 | GNUNET_free (bindto); |
3643 | GNUNET_free (start); | ||
3638 | } | 3644 | } |
3639 | 3645 | ||
3640 | 3646 | ||
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 415dc4b48..d75f4ae00 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -1492,16 +1492,9 @@ add_acks (struct SharedSecret *ss, int acks_to_add) | |||
1492 | 1492 | ||
1493 | struct ReceiverAddress *receiver = ss->receiver; | 1493 | struct ReceiverAddress *receiver = ss->receiver; |
1494 | 1494 | ||
1495 | if (NULL == ss) | 1495 | GNUNET_assert (NULL != ss); |
1496 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1496 | GNUNET_assert (NULL != receiver); |
1497 | "secret NULL!\n"); | 1497 | GNUNET_assert (NULL != receiver->d_qh); |
1498 | |||
1499 | if (NULL == receiver) | ||
1500 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1501 | "Receiver NULL!\n"); | ||
1502 | if (NULL == receiver->d_qh) | ||
1503 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1504 | "Queue NULL!\n"); | ||
1505 | 1498 | ||
1506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1507 | "Tell transport we have %u more acks!\n", | 1500 | "Tell transport we have %u more acks!\n", |
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 468048bec..cbf795eea 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -9639,11 +9639,13 @@ handle_add_queue_message (void *cls, | |||
9639 | { | 9639 | { |
9640 | if (queue->qid != aqm->qid) | 9640 | if (queue->qid != aqm->qid) |
9641 | continue; | 9641 | continue; |
9642 | neighbour = queue->neighbour; | ||
9643 | break; | 9642 | break; |
9644 | } | 9643 | } |
9645 | if (NULL == queue) | 9644 | |
9645 | if (NULL != queue) | ||
9646 | { | 9646 | { |
9647 | neighbour = queue->neighbour; | ||
9648 | } else { | ||
9647 | neighbour = lookup_neighbour (&aqm->receiver); | 9649 | neighbour = lookup_neighbour (&aqm->receiver); |
9648 | if (NULL == neighbour) | 9650 | if (NULL == neighbour) |
9649 | { | 9651 | { |
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c index de356fb9c..040f16d5d 100644 --- a/src/transport/transport-testing-communicator.c +++ b/src/transport/transport-testing-communicator.c | |||
@@ -548,6 +548,11 @@ handle_update_queue_message (void *cls, | |||
548 | tc_queue = tc_queue->next; | 548 | tc_queue = tc_queue->next; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | if (NULL == tc_queue) | ||
552 | { | ||
553 | GNUNET_SERVICE_client_continue (client->client); | ||
554 | return; | ||
555 | } | ||
551 | GNUNET_assert (tc_queue->qid == msg->qid); | 556 | GNUNET_assert (tc_queue->qid == msg->qid); |
552 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); | 557 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); |
553 | tc_queue->nt = msg->nt; | 558 | tc_queue->nt = msg->nt; |