diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-15 09:15:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-15 09:15:10 +0000 |
commit | 76a45b2a02fb085b2648af475a20bb8980dbd35c (patch) | |
tree | af2b4fe747c672efcd4e687b69e3dc13a9b08244 /src/dht | |
parent | 164dec8a9cd3c8a74101137654fc2631af119f9b (diff) | |
download | gnunet-76a45b2a02fb085b2648af475a20bb8980dbd35c.tar.gz gnunet-76a45b2a02fb085b2648af475a20bb8980dbd35c.zip |
fix leak
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index d71f9ce50..d8527edbc 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -4988,10 +4988,6 @@ handle_dht_p2p_route_result (void *cls, | |||
4988 | 4988 | ||
4989 | memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext)); | 4989 | memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext)); |
4990 | // FIXME: call GNUNET_BLOCK_evaluate (...) -- instead of doing your own bloomfilter! | 4990 | // FIXME: call GNUNET_BLOCK_evaluate (...) -- instead of doing your own bloomfilter! |
4991 | msg_ctx.bloom = | ||
4992 | GNUNET_CONTAINER_bloomfilter_init (incoming->bloomfilter, DHT_BLOOM_SIZE, | ||
4993 | DHT_BLOOM_K); | ||
4994 | GNUNET_assert (msg_ctx.bloom != NULL); | ||
4995 | memcpy (&msg_ctx.key, &incoming->key, sizeof (GNUNET_HashCode)); | 4991 | memcpy (&msg_ctx.key, &incoming->key, sizeof (GNUNET_HashCode)); |
4996 | msg_ctx.unique_id = GNUNET_ntohll (incoming->unique_id); | 4992 | msg_ctx.unique_id = GNUNET_ntohll (incoming->unique_id); |
4997 | msg_ctx.msg_options = ntohl (incoming->options); | 4993 | msg_ctx.msg_options = ntohl (incoming->options); |
@@ -5004,10 +5000,15 @@ handle_dht_p2p_route_result (void *cls, | |||
5004 | if (ntohs(message->size) - sizeof(struct GNUNET_DHT_P2PRouteResultMessage) - ntohs(enc_msg->size) != | 5000 | if (ntohs(message->size) - sizeof(struct GNUNET_DHT_P2PRouteResultMessage) - ntohs(enc_msg->size) != |
5005 | ntohl (incoming->outgoing_path_length) * sizeof(struct GNUNET_PeerIdentity)) | 5001 | ntohl (incoming->outgoing_path_length) * sizeof(struct GNUNET_PeerIdentity)) |
5006 | { | 5002 | { |
5007 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Return message indicated a path was included, but sizes are wrong!\nTotal message size %d, enc_msg size %d, left over %d, expected %d\n", | 5003 | #if DEBUG_DHT |
5008 | ntohs(message->size), ntohs(enc_msg->size), | 5004 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
5009 | ntohs(message->size) - sizeof(struct GNUNET_DHT_P2PRouteResultMessage) - ntohs(enc_msg->size), | 5005 | "Return message indicated a path was included, but sizes are wrong: Total size %d, enc size %d, left %d, expected %d\n", |
5010 | ntohl(incoming->outgoing_path_length) * sizeof(struct GNUNET_PeerIdentity)); | 5006 | ntohs(message->size), |
5007 | ntohs(enc_msg->size), | ||
5008 | ntohs(message->size) - sizeof(struct GNUNET_DHT_P2PRouteResultMessage) - ntohs(enc_msg->size), | ||
5009 | ntohl(incoming->outgoing_path_length) * sizeof(struct GNUNET_PeerIdentity)); | ||
5010 | #endif | ||
5011 | GNUNET_break_op (0); | ||
5011 | return GNUNET_NO; | 5012 | return GNUNET_NO; |
5012 | } | 5013 | } |
5013 | msg_ctx.path_history = (char *)&incoming[1]; | 5014 | msg_ctx.path_history = (char *)&incoming[1]; |
@@ -5017,10 +5018,18 @@ handle_dht_p2p_route_result (void *cls, | |||
5017 | for (i = 0; i < msg_ctx.path_history_len; i++) | 5018 | for (i = 0; i < msg_ctx.path_history_len; i++) |
5018 | { | 5019 | { |
5019 | path_offset = &msg_ctx.path_history[i * sizeof(struct GNUNET_PeerIdentity)]; | 5020 | path_offset = &msg_ctx.path_history[i * sizeof(struct GNUNET_PeerIdentity)]; |
5020 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "(handle_p2p_route_result) Key %s Found peer %d:%s\n", GNUNET_h2s(&msg_ctx.key), i, GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset)); | 5021 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5022 | "(handle_p2p_route_result) Key %s Found peer %d:%s\n", | ||
5023 | GNUNET_h2s(&msg_ctx.key), | ||
5024 | i, | ||
5025 | GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset)); | ||
5021 | } | 5026 | } |
5022 | #endif | 5027 | #endif |
5023 | } | 5028 | } |
5029 | msg_ctx.bloom = | ||
5030 | GNUNET_CONTAINER_bloomfilter_init (incoming->bloomfilter, DHT_BLOOM_SIZE, | ||
5031 | DHT_BLOOM_K); | ||
5032 | GNUNET_assert (msg_ctx.bloom != NULL); | ||
5024 | route_result_message (enc_msg, &msg_ctx); | 5033 | route_result_message (enc_msg, &msg_ctx); |
5025 | return GNUNET_YES; | 5034 | return GNUNET_YES; |
5026 | } | 5035 | } |