aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-26 15:34:51 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-26 15:34:51 +0000
commitb5a4052779cba718ff887c6b43c2d20d5e076510 (patch)
treec4cece9ec564177f35817e2ad0cd589fbcaca7a2 /src/set
parentb56fbb9f87a5c16f39ae974bc192a78d28e5931e (diff)
downloadgnunet-b5a4052779cba718ff887c6b43c2d20d5e076510.tar.gz
gnunet-b5a4052779cba718ff887c6b43c2d20d5e076510.zip
- fixed a double-free-race upon failing a set op
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set_intersection.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index 4709e3d82..6b2473e26 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -343,9 +343,10 @@ fail_intersection_operation (struct Operation *op)
343 struct GNUNET_MQ_Envelope *ev; 343 struct GNUNET_MQ_Envelope *ev;
344 struct GNUNET_SET_ResultMessage *msg; 344 struct GNUNET_SET_ResultMessage *msg;
345 345
346 if (op->state->my_elements) 346 if (op->state->my_elements){
347 GNUNET_CONTAINER_multihashmap_destroy(op->state->my_elements); 347 GNUNET_CONTAINER_multihashmap_destroy(op->state->my_elements);
348 348 op->state->my_elements = NULL;
349 }
349 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "intersection operation failed\n"); 350 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "intersection operation failed\n");
350 351
351 ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_RESULT); 352 ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_RESULT);
@@ -744,13 +745,11 @@ handle_p2p_element_info (void *cls, const struct GNUNET_MessageHeader *mh)
744 745
745 op->spec->remote_element_count = ntohl(msg->sender_element_count); 746 op->spec->remote_element_count = ntohl(msg->sender_element_count);
746 if ((op->state->phase != PHASE_INITIAL) 747 if ((op->state->phase != PHASE_INITIAL)
747 || (op->state->my_element_count > op->spec->remote_element_count)){ 748 || (op->state->my_element_count > op->spec->remote_element_count)
749 || (0 == op->state->my_element_count)
750 || (0 == op->spec->remote_element_count)){
748 GNUNET_break_op (0); 751 GNUNET_break_op (0);
749 fail_intersection_operation(op); 752 fail_intersection_operation(op);
750 }
751
752 if (0 == op->state->my_element_count) {
753 send_peer_done (op);
754 return; 753 return;
755 } 754 }
756 755
@@ -1045,12 +1044,12 @@ intersection_op_cancel (struct Operation *op)
1045 GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf); 1044 GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf);
1046 op->state->local_bf = NULL; 1045 op->state->local_bf = NULL;
1047 } 1046 }
1048 if (NULL != op->state->my_elements) 1047/* if (NULL != op->state->my_elements)
1049 { 1048 {
1050 // no need to free the elements, they are still part of the set 1049 // no need to free the elements, they are still part of the set
1051 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); 1050 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements);
1052 op->state->my_elements = NULL; 1051 op->state->my_elements = NULL;
1053 } 1052 }*/
1054 GNUNET_free (op->state); 1053 GNUNET_free (op->state);
1055 op->state = NULL; 1054 op->state = NULL;
1056 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying intersection op done\n"); 1055 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying intersection op done\n");