aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-03 09:28:25 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-03 09:28:25 +0000
commit82acee90436c8ab6fc736be4b9daf269af6352d2 (patch)
treeac7477c60df4aae519b724025b6acb3c2dd5428a /src/transport/gnunet-service-transport.c
parentdc35fb3ef01e26eb7a69fdfcafd4632fb1493908 (diff)
downloadgnunet-82acee90436c8ab6fc736be4b9daf269af6352d2.tar.gz
gnunet-82acee90436c8ab6fc736be4b9daf269af6352d2.zip
LRN:
A bit less dirty transport crash fix Basically, it now also frees mq before returning. The logic is kinda complex for such a small thing, but it's either that, or having two GNUNET_free (mq) statements. Although maybe you can postpone freeing mq until the end of the function (see v2 patch). [this is the v2 patch]
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 74ff1749c..07e9a0d89 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -1613,22 +1613,21 @@ transmit_send_continuation (void *cls, const struct GNUNET_PeerIdentity *target,
1613 mq->specific_address->in_transmit = GNUNET_NO; 1613 mq->specific_address->in_transmit = GNUNET_NO;
1614 } 1614 }
1615 n = find_neighbour (&mq->neighbour_id); 1615 n = find_neighbour (&mq->neighbour_id);
1616 if (n == NULL) 1616 if (n != NULL)
1617 { 1617 {
1618 if (mq->client != NULL)
1619 transmit_send_ok (mq->client, n, target, result);
1620 GNUNET_CONTAINER_DLL_remove (n->cont_head, n->cont_tail, mq);
1621 if (result == GNUNET_OK)
1622 try_transmission_to_peer (n);
1623 else if (GNUNET_SCHEDULER_NO_TASK == n->retry_task)
1624 n->retry_task = GNUNET_SCHEDULER_add_now (&retry_transmission_task, n);
1625 }
1626 else
1618 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "transmit_send_continuation", 1627 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "transmit_send_continuation",
1619 "Neighbour `%s' no longer exists\n", 1628 "Neighbour `%s' no longer exists\n",
1620 GNUNET_i2s (&mq->neighbour_id)); 1629 GNUNET_i2s (&mq->neighbour_id));
1621 return;
1622 }
1623 if (mq->client != NULL)
1624 transmit_send_ok (mq->client, n, target, result);
1625 GNUNET_assert (n != NULL);
1626 GNUNET_CONTAINER_DLL_remove (n->cont_head, n->cont_tail, mq);
1627 GNUNET_free (mq); 1630 GNUNET_free (mq);
1628 if (result == GNUNET_OK)
1629 try_transmission_to_peer (n);
1630 else if (GNUNET_SCHEDULER_NO_TASK == n->retry_task)
1631 n->retry_task = GNUNET_SCHEDULER_add_now (&retry_transmission_task, n);
1632} 1631}
1633 1632
1634 1633