aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-06-28 12:33:06 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-06-28 12:33:06 +0000
commit196247d4c8ca504115784600a9809d1129f33d22 (patch)
tree2d2afc9d45b2af9257cf3b0e733b37380698e8f1 /src
parent20d956977c3ca2f42830c07bebc37ec67a7d39a5 (diff)
downloadgnunet-196247d4c8ca504115784600a9809d1129f33d22.tar.gz
gnunet-196247d4c8ca504115784600a9809d1129f33d22.zip
fixing memory leak mantis #1700
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 51e84e1dd..b96ae6c22 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -489,6 +489,18 @@ struct NeighbourList
489 struct MessageQueue *messages_tail; 489 struct MessageQueue *messages_tail;
490 490
491 /** 491 /**
492 * Head of list of messages of messages we expected the continuation
493 * to be called to destroy the message
494 */
495 struct MessageQueue *cont_head;
496
497 /**
498 * Tail of list of messages of messages we expected the continuation
499 * to be called to destroy the message
500 */
501 struct MessageQueue *cont_tail;
502
503 /**
492 * Buffer for at most one payload message used when we receive 504 * Buffer for at most one payload message used when we receive
493 * payload data before our PING-PONG has succeeded. We then 505 * payload data before our PING-PONG has succeeded. We then
494 * store such messages in this intermediary buffer until the 506 * store such messages in this intermediary buffer until the
@@ -1909,6 +1921,12 @@ transmit_send_continuation (void *cls,
1909 n = find_neighbour(&mq->neighbour_id); 1921 n = find_neighbour(&mq->neighbour_id);
1910 if (mq->client != NULL) 1922 if (mq->client != NULL)
1911 transmit_send_ok (mq->client, n, target, result); 1923 transmit_send_ok (mq->client, n, target, result);
1924 if (n != NULL)
1925 {
1926 GNUNET_CONTAINER_DLL_remove (n->cont_head,
1927 n->cont_tail,
1928 mq);
1929 }
1912 GNUNET_free (mq); 1930 GNUNET_free (mq);
1913 if (n != NULL) 1931 if (n != NULL)
1914 try_transmission_to_peer (n); 1932 try_transmission_to_peer (n);
@@ -2047,6 +2065,11 @@ try_transmission_to_peer (struct NeighbourList *n)
2047 gettext_noop ("# bytes pending with plugins"), 2065 gettext_noop ("# bytes pending with plugins"),
2048 mq->message_buf_size, 2066 mq->message_buf_size,
2049 GNUNET_NO); 2067 GNUNET_NO);
2068
2069 GNUNET_CONTAINER_DLL_insert (n->cont_head,
2070 n->cont_tail,
2071 mq);
2072
2050 ret = rl->plugin->api->send (rl->plugin->api->cls, 2073 ret = rl->plugin->api->send (rl->plugin->api->cls,
2051 &mq->neighbour_id, 2074 &mq->neighbour_id,
2052 mq->message_buf, 2075 mq->message_buf,
@@ -5116,6 +5139,19 @@ disconnect_neighbour (struct NeighbourList *n, int check)
5116 sizeof(struct GNUNET_PeerIdentity))); 5139 sizeof(struct GNUNET_PeerIdentity)));
5117 GNUNET_free (mq); 5140 GNUNET_free (mq);
5118 } 5141 }
5142
5143 while (NULL != (mq = n->cont_head))
5144 {
5145
5146 GNUNET_CONTAINER_DLL_remove (n->cont_head,
5147 n->cont_tail,
5148 mq);
5149 GNUNET_assert (0 == memcmp(&mq->neighbour_id,
5150 &n->id,
5151 sizeof(struct GNUNET_PeerIdentity)));
5152 GNUNET_free (mq);
5153 }
5154
5119 if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK) 5155 if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK)
5120 { 5156 {
5121 GNUNET_SCHEDULER_cancel (n->timeout_task); 5157 GNUNET_SCHEDULER_cancel (n->timeout_task);