aboutsummaryrefslogtreecommitdiff
path: root/src/set/set_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-30 00:44:56 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-30 00:44:56 +0000
commit991f51dc78d1690bdf169bca8028a3d0c5fbb177 (patch)
treed598342dc1458e3a6cbe1eb99dd07745689c16c8 /src/set/set_api.c
parent7dc458f1c96853831b607c61572270d62efd86d2 (diff)
downloadgnunet-991f51dc78d1690bdf169bca8028a3d0c5fbb177.tar.gz
gnunet-991f51dc78d1690bdf169bca8028a3d0c5fbb177.zip
-avoid use after free during set intersection completion
Diffstat (limited to 'src/set/set_api.c')
-rw-r--r--src/set/set_api.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 20a9d149a..453a235b2 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -306,6 +306,10 @@ handle_result (void *cls,
306 msg = (const struct GNUNET_SET_ResultMessage *) mh; 306 msg = (const struct GNUNET_SET_ResultMessage *) mh;
307 GNUNET_assert (NULL != set->mq); 307 GNUNET_assert (NULL != set->mq);
308 result_status = ntohs (msg->result_status); 308 result_status = ntohs (msg->result_status);
309 LOG (GNUNET_ERROR_TYPE_DEBUG,
310 "Got result message with status %d\n",
311 result_status);
312
309 oh = GNUNET_MQ_assoc_get (set->mq, 313 oh = GNUNET_MQ_assoc_get (set->mq,
310 ntohl (msg->request_id)); 314 ntohl (msg->request_id));
311 if (NULL == oh) 315 if (NULL == oh)
@@ -331,6 +335,19 @@ handle_result (void *cls,
331 oh->result_cb (oh->result_cls, 335 oh->result_cb (oh->result_cls,
332 NULL, 336 NULL,
333 result_status); 337 result_status);
338 switch (result_status)
339 {
340 case GNUNET_SET_STATUS_OK:
341 break;
342 case GNUNET_SET_STATUS_FAILURE:
343 oh->result_cb = NULL;
344 break;
345 case GNUNET_SET_STATUS_HALF_DONE:
346 break;
347 case GNUNET_SET_STATUS_DONE:
348 oh->result_cb = NULL;
349 break;
350 }
334 GNUNET_free (oh); 351 GNUNET_free (oh);
335 return; 352 return;
336 } 353 }
@@ -417,7 +434,8 @@ handle_client_set_error (void *cls,
417 struct GNUNET_SET_Handle *set = cls; 434 struct GNUNET_SET_Handle *set = cls;
418 435
419 LOG (GNUNET_ERROR_TYPE_DEBUG, 436 LOG (GNUNET_ERROR_TYPE_DEBUG,
420 "Handling client set error\n"); 437 "Handling client set error %d\n",
438 error);
421 while (NULL != set->ops_head) 439 while (NULL != set->ops_head)
422 { 440 {
423 if (NULL != set->ops_head->result_cb) 441 if (NULL != set->ops_head->result_cb)
@@ -479,7 +497,8 @@ GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
479 } 497 }
480 set->mq = GNUNET_MQ_queue_for_connection_client (set->client, 498 set->mq = GNUNET_MQ_queue_for_connection_client (set->client,
481 mq_handlers, 499 mq_handlers,
482 &handle_client_set_error, set); 500 &handle_client_set_error,
501 set);
483 GNUNET_assert (NULL != set->mq); 502 GNUNET_assert (NULL != set->mq);
484 mqm = GNUNET_MQ_msg (msg, 503 mqm = GNUNET_MQ_msg (msg,
485 GNUNET_MESSAGE_TYPE_SET_CREATE); 504 GNUNET_MESSAGE_TYPE_SET_CREATE);