From: Matthias Wachs Date: Tue, 18 Oct 2011 16:31:08 +0000 (+0000) Subject: coverity fixes X-Git-Tag: initial-import-from-subversion-38251~16419 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8f91676bbbc14224bfc5cec98509f84794927f0b;p=oweals%2Fgnunet.git coverity fixes --- diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c index 05a3e257a..d2a7b53dc 100644 --- a/src/ats/test_ats_api_bandwidth_consumption.c +++ b/src/ats/test_ats_api_bandwidth_consumption.c @@ -258,6 +258,8 @@ check (void *cls, char *const *args, const char *cfgfile, ret = GNUNET_SYSERR; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to init ATS performance\n"); end_badly(NULL, NULL); + GNUNET_free (p); + GNUNET_free (addr); return; } diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index c116a9d77..a2024953c 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -405,7 +405,6 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls) GNUNET_NO); return len; - client_wake_up(NULL,NULL); } /** diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 4ae0df35a..c1c35d4ba 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -145,7 +145,7 @@ server_load_certificate (struct Plugin *plugin) GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name, "CERT_FILE", &cert_file)) { - cert_file = "https_cert.crt"; + GNUNET_asprintf(&cert_file, "%s", "https_cert.crt"); } /* read key & certificates from file */ diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index f4a806723..ddb6187e5 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -681,11 +681,14 @@ udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, } } //session_invalid: + if ((addr == NULL) && (addrlen == 0)) + return GNUNET_SYSERR; peer_session = create_session (plugin, target, addr, addrlen, cont, cont_cls); if (peer_session == NULL) { if (cont != NULL) cont (cont_cls, target, GNUNET_SYSERR); + return GNUNET_SYSERR;; } /* Message */ diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 81a0b39e1..6b6cc0c0e 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -150,6 +150,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, t = p1; if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity))) t = p2; + GNUNET_assert (t != NULL); char * ps = strdup (GNUNET_i2s(&p->id)); @@ -245,6 +246,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, t = p1; if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity))) t = p2; + GNUNET_assert (t!=NULL); char * ps = strdup (GNUNET_i2s(&p->id)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%4s'): peer %u (`%s') connected to me!\n", diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c index 721154f9e..1349a0c4d 100644 --- a/src/transport/test_transport_startonly.c +++ b/src/transport/test_transport_startonly.c @@ -150,7 +150,7 @@ run (void *cls, char *const *args, const char *cfgfile, fprintf (stderr, "..%i", i); } - GNUNET_TRANSPORT_TESTING_init (tth); + tth = GNUNET_TRANSPORT_TESTING_init (); fprintf (stderr, "\n"); end (); diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 0079bc421..5d0e990f7 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c @@ -91,6 +91,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, { struct PeerContext *p = cls; /* Find PeerContext */ + GNUNET_assert (p != 0); GNUNET_assert (p->tth != NULL); struct PeerContext * p2 = find_peer_context (p->tth, peer); @@ -136,8 +137,15 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PeerContext *p = cls; /* Find PeerContext */ - GNUNET_assert (p->tth != NULL); - struct PeerContext * p2 = find_peer_context (p->tth, peer); + int no = 0; + struct PeerContext * p2 = NULL; + + if (p != NULL) + { + GNUNET_assert (p->tth != NULL); + p2 = find_peer_context (p->tth, peer); + no = p->no; + } char * p2_s; if (p2 != NULL) @@ -147,7 +155,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", "Peers %s disconnected from peer %u (`%s')\n", p2_s, - p->no, GNUNET_i2s (&p->id)); + no , GNUNET_i2s (&p->id)); GNUNET_free (p2_s); if (p == NULL)