aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-11-20 17:55:45 +0000
committerNathan S. Evans <evans@in.tum.de>2010-11-20 17:55:45 +0000
commit04a52fec55d934e5a863cc9e860db9387f78a3b5 (patch)
tree486c3556d9c81282b618be92d095d82051f4deef /src/dht/gnunet-service-dht.c
parent2d2584e78b01b66e45fe10952ecebb6e9ef9d451 (diff)
downloadgnunet-04a52fec55d934e5a863cc9e860db9387f78a3b5.tar.gz
gnunet-04a52fec55d934e5a863cc9e860db9387f78a3b5.zip
only free when necessary (double free bug)
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index cd0c143a0..00fa62398 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -2115,7 +2115,10 @@ static int route_result_message(struct GNUNET_MessageHeader *msg,
2115 pos = pos->next; 2115 pos = pos->next;
2116 } 2116 }
2117 if (msg_ctx->bloom != NULL) 2117 if (msg_ctx->bloom != NULL)
2118 {
2118 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom); 2119 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom);
2120 msg_ctx->bloom = NULL;
2121 }
2119 return 0; 2122 return 0;
2120} 2123}
2121 2124
@@ -3458,7 +3461,10 @@ route_message(const struct GNUNET_MessageHeader *msg,
3458 } 3461 }
3459#endif 3462#endif
3460 if (msg_ctx->bloom != NULL) 3463 if (msg_ctx->bloom != NULL)
3464 {
3461 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom); 3465 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom);
3466 msg_ctx->bloom = NULL;
3467 }
3462 return; 3468 return;
3463 } 3469 }
3464 3470
@@ -3506,7 +3512,6 @@ route_message(const struct GNUNET_MessageHeader *msg,
3506 } 3512 }
3507#endif 3513#endif
3508 3514
3509
3510 GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom, &my_identity.hashPubKey); 3515 GNUNET_CONTAINER_bloomfilter_add (msg_ctx->bloom, &my_identity.hashPubKey);
3511 hash_from_uid (msg_ctx->unique_id, &unique_hash); 3516 hash_from_uid (msg_ctx->unique_id, &unique_hash);
3512 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (recent.hashmap, &unique_hash)) 3517 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (recent.hashmap, &unique_hash))
@@ -3581,6 +3586,7 @@ route_message(const struct GNUNET_MessageHeader *msg,
3581 { 3586 {
3582 GNUNET_CONTAINER_bloomfilter_or2(recent_req->bloom, msg_ctx->bloom, DHT_BLOOM_SIZE); 3587 GNUNET_CONTAINER_bloomfilter_or2(recent_req->bloom, msg_ctx->bloom, DHT_BLOOM_SIZE);
3583 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom); 3588 GNUNET_CONTAINER_bloomfilter_free(msg_ctx->bloom);
3589 msg_ctx->bloom = NULL;
3584 } 3590 }
3585} 3591}
3586 3592
@@ -4270,7 +4276,11 @@ handle_dht_p2p_route_request (void *cls,
4270 msg_ctx->importance = DHT_DEFAULT_P2P_IMPORTANCE; 4276 msg_ctx->importance = DHT_DEFAULT_P2P_IMPORTANCE;
4271 msg_ctx->timeout = DHT_DEFAULT_P2P_TIMEOUT; 4277 msg_ctx->timeout = DHT_DEFAULT_P2P_TIMEOUT;
4272 demultiplex_message(enc_msg, msg_ctx); 4278 demultiplex_message(enc_msg, msg_ctx);
4273 GNUNET_CONTAINER_bloomfilter_free (msg_ctx->bloom); 4279 if (msg_ctx->bloom != NULL)
4280 {
4281 GNUNET_CONTAINER_bloomfilter_free (msg_ctx->bloom);
4282 msg_ctx->bloom = NULL;
4283 }
4274 GNUNET_free(msg_ctx); 4284 GNUNET_free(msg_ctx);
4275 return GNUNET_YES; 4285 return GNUNET_YES;
4276} 4286}