aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-19 14:01:18 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-19 14:01:18 +0000
commit9b3124e045a61865805b7a97f87700609cb926cb (patch)
treef46fae02dcdb3e007d9b1618ab1052420464a78a /src/cadet
parentdc0da39a4d4a086b5286ae4705a3b96695d2f5f0 (diff)
downloadgnunet-9b3124e045a61865805b7a97f87700609cb926cb.tar.gz
gnunet-9b3124e045a61865805b7a97f87700609cb926cb.zip
-fix sec_name leak
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/cadet_api.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index fa84c3930..f1fc6f14b 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -526,13 +526,13 @@ static void
526timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 526timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
527{ 527{
528 struct GNUNET_CADET_TransmitHandle *th = cls; 528 struct GNUNET_CADET_TransmitHandle *th = cls;
529 struct GNUNET_CADET_Handle *cadet; 529 struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
530 530
531 cadet = th->channel->cadet; 531 th->timeout_task = GNUNET_SCHEDULER_NO_TASK;
532 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
533 th->channel->packet_size = 0; 532 th->channel->packet_size = 0;
533 GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
534 if (GNUNET_YES == th_is_payload (th)) 534 if (GNUNET_YES == th_is_payload (th))
535 th->notify (th->notify_cls, 0, NULL); 535 GNUNET_break (0 == th->notify (th->notify_cls, 0, NULL));
536 GNUNET_free (th); 536 GNUNET_free (th);
537 if ((0 == message_ready_size (cadet)) && (NULL != cadet->th)) 537 if ((0 == message_ready_size (cadet)) && (NULL != cadet->th))
538 { 538 {
@@ -1373,15 +1373,15 @@ send_callback (void *cls, size_t size, void *buf)
1373 } 1373 }
1374 else 1374 else
1375 { 1375 {
1376 struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1]; 1376 const struct GNUNET_MessageHeader *mh;
1377 1377
1378 mh = (const struct GNUNET_MessageHeader *) &th[1];
1378 LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n", 1379 LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n",
1379 GC_m2s (ntohs (mh->type))); 1380 GC_m2s (ntohs (mh->type)));
1380 memcpy (cbuf, &th[1], th->size); 1381 memcpy (cbuf, &th[1], th->size);
1381 psize = th->size; 1382 psize = th->size;
1382 } 1383 }
1383 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize); 1384 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
1384
1385 if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) 1385 if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK)
1386 GNUNET_SCHEDULER_cancel (th->timeout_task); 1386 GNUNET_SCHEDULER_cancel (th->timeout_task);
1387 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); 1387 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
@@ -1448,9 +1448,6 @@ send_packet (struct GNUNET_CADET_Handle *h,
1448 th->channel = channel; 1448 th->channel = channel;
1449 memcpy (&th[1], msg, msize); 1449 memcpy (&th[1], msg, msize);
1450 add_to_queue (h, th); 1450 add_to_queue (h, th);
1451 LOG (GNUNET_ERROR_TYPE_DEBUG, " queued\n");
1452 if (NULL != h->th)
1453 return;
1454 LOG (GNUNET_ERROR_TYPE_DEBUG, " calling ntfy tmt rdy for %u bytes\n", msize); 1451 LOG (GNUNET_ERROR_TYPE_DEBUG, " calling ntfy tmt rdy for %u bytes\n", msize);
1455 h->th = 1452 h->th =
1456 GNUNET_CLIENT_notify_transmit_ready (h->client, msize, 1453 GNUNET_CLIENT_notify_transmit_ready (h->client, msize,
@@ -1656,9 +1653,14 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
1656 if (th->channel == channel) 1653 if (th->channel == channel)
1657 { 1654 {
1658 aux = th->next; 1655 aux = th->next;
1659 /* FIXME call the handler? */
1660 if (GNUNET_YES == th_is_payload (th)) 1656 if (GNUNET_YES == th_is_payload (th))
1657 {
1658 /* applications should cancel before destroying channel */
1659 GNUNET_break (0);
1661 th->notify (th->notify_cls, 0, NULL); 1660 th->notify (th->notify_cls, 0, NULL);
1661 }
1662 GNUNET_CADET_notify_transmit_ready_cancel (th);
1663
1662 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th); 1664 GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
1663 GNUNET_free (th); 1665 GNUNET_free (th);
1664 th = aux; 1666 th = aux;