From 1fe2032dbd294989ce839d2b8f9415b3b677b1d7 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 25 Apr 2012 13:03:44 +0000 Subject: [PATCH] - coverity bugs --- src/ats/gnunet-service-ats_addresses_mlp.c | 2 +- src/integration-tests/connection_watchdog.c | 4 ++-- src/namestore/gnunet-service-namestore.c | 7 ++++++- src/transport/plugin_transport_tcp.c | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index 043f89770..d4c2c177a 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c @@ -593,7 +593,7 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON /* Set -r */ ia[mlp->ci] = peer->r_c9; ja[mlp->ci] = mlp->c_r; - ar[mlp->ci] = -1; + ar[mlp->ci] = -peer->f; mlp->ci++; #endif /* For all addresses of this peer */ diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c index 242322bb6..e2d725c6d 100644 --- a/src/integration-tests/connection_watchdog.c +++ b/src/integration-tests/connection_watchdog.c @@ -144,7 +144,7 @@ int map_cleanup_it (void *cls, void *value) { struct PeerContainer *pc = value; - GNUNET_CONTAINER_multihashmap_remove(peers, key, value); + GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove(peers, key, value)); if (NULL != pc->th_ping) { GNUNET_TRANSPORT_notify_transmit_ready_cancel(pc->th_ping); @@ -927,7 +927,7 @@ core_disconnect_cb (void *cls, { if (0 != memcmp (peer, &my_peer_id, sizeof (struct GNUNET_PeerIdentity))) { - GNUNET_assert (core_connections >= 0); + GNUNET_assert (core_connections > 0); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "CORE disconnect for peer `%s' (%u total)\n", GNUNET_i2s (peer), core_connections); map_disconnect (peer, ch); diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 7fd8d7dc4..7f782051b 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -1480,7 +1480,7 @@ void zone_iteraterate_proc (void *cls, proc->rd = NULL; proc->name = NULL; } - else + else if ((zone_key != NULL) && (name != NULL)) /* just a safety check */ { rd_filtered = GNUNET_malloc (rd_count * sizeof (struct GNUNET_NAMESTORE_RecordData)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received result for zone iteration: `%s'\n", name); @@ -1568,6 +1568,11 @@ void zone_iteraterate_proc (void *cls, } } } + else + { + GNUNET_break (0); + return; + } } diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 54bcf16ef..c5682e16a 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -1906,6 +1906,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_a2s(vaddr, alen)); GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); + GNUNET_free_non_null(vaddr); return; } else if (GNUNET_YES == session->expecting_welcome) @@ -1921,6 +1922,7 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_a2s(vaddr, alen)); GNUNET_break_op (0); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); + GNUNET_free_non_null(vaddr); return; } -- 2.25.1