aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-04-12 12:51:08 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-04-12 12:51:08 +0000
commite60d0c42e0ccca277117de7ac7b5669abf5e336c (patch)
tree974307e83e2f8f40a3a694d014fbe446ea6412a1
parent95e495ccbd15ee84d0d986bcc3d26889f73d8ce8 (diff)
downloadgnunet-e60d0c42e0ccca277117de7ac7b5669abf5e336c.tar.gz
gnunet-e60d0c42e0ccca277117de7ac7b5669abf5e336c.zip
- fix memleak complaints from valgrind
-rw-r--r--src/testbed/gnunet-service-testbed.c8
-rw-r--r--src/testbed/gnunet-service-testbed_links.c18
2 files changed, 10 insertions, 16 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 7864b0984..9c66634dc 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -851,15 +851,15 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
851 GST_neighbour_list_clean(); 851 GST_neighbour_list_clean();
852 /* Clear peer list */ 852 /* Clear peer list */
853 GST_destroy_peers (); 853 GST_destroy_peers ();
854 /* Clear route list */
855 GST_route_list_clear ();
856 /* Clear GST_slave_list */
857 GST_slave_list_clear ();
854 /* Clear host list */ 858 /* Clear host list */
855 for (id = 0; id < GST_host_list_size; id++) 859 for (id = 0; id < GST_host_list_size; id++)
856 if (NULL != GST_host_list[id]) 860 if (NULL != GST_host_list[id])
857 GNUNET_TESTBED_host_destroy (GST_host_list[id]); 861 GNUNET_TESTBED_host_destroy (GST_host_list[id]);
858 GNUNET_free_non_null (GST_host_list); 862 GNUNET_free_non_null (GST_host_list);
859 /* Clear route list */
860 GST_route_list_clear ();
861 /* Clear GST_slave_list */
862 GST_slave_list_clear ();
863 if (NULL != GST_context) 863 if (NULL != GST_context)
864 { 864 {
865 GNUNET_free_non_null (GST_context->master_ip); 865 GNUNET_free_non_null (GST_context->master_ip);
diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c
index ae984e331..6ed57dd02 100644
--- a/src/testbed/gnunet-service-testbed_links.c
+++ b/src/testbed/gnunet-service-testbed_links.c
@@ -95,12 +95,6 @@ struct LCFContext
95 struct GNUNET_TESTBED_Operation *op; 95 struct GNUNET_TESTBED_Operation *op;
96 96
97 /** 97 /**
98 * The configuration which has to be either used as a template while starting
99 * the delegated controller or for connecting to the delegated controller
100 */
101 struct GNUNET_CONFIGURATION_Handle *cfg;
102
103 /**
104 * The timeout task 98 * The timeout task
105 */ 99 */
106 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 100 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
@@ -449,7 +443,10 @@ send_controller_link_response (struct GNUNET_SERVER_Client *client,
449 msg->operation_id = GNUNET_htonll (operation_id); 443 msg->operation_id = GNUNET_htonll (operation_id);
450 msg->config_size = htons ((uint16_t) config_size); 444 msg->config_size = htons ((uint16_t) config_size);
451 if (NULL != xconfig) 445 if (NULL != xconfig)
446 {
452 memcpy (&msg[1], xconfig, xconfig_size); 447 memcpy (&msg[1], xconfig, xconfig_size);
448 GNUNET_free (xconfig);
449 }
453 if (NULL != emsg) 450 if (NULL != emsg)
454 memcpy (&msg[1], emsg, strlen (emsg)); 451 memcpy (&msg[1], emsg, strlen (emsg));
455 GST_queue_message (client, &msg->header); 452 GST_queue_message (client, &msg->header);
@@ -598,8 +595,6 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
598 case FINISHED: 595 case FINISHED:
599 lcfq = lcfq_head; 596 lcfq = lcfq_head;
600 GNUNET_assert (lcfq->lcf == lcf); 597 GNUNET_assert (lcfq->lcf == lcf);
601 GNUNET_assert (NULL != lcf->cfg);
602 GNUNET_CONFIGURATION_destroy (lcf->cfg);
603 GNUNET_SERVER_client_drop (lcf->client); 598 GNUNET_SERVER_client_drop (lcf->client);
604 GNUNET_TESTBED_operation_done (lcf->op); 599 GNUNET_TESTBED_operation_done (lcf->op);
605 GNUNET_free (lcf); 600 GNUNET_free (lcf);
@@ -783,6 +778,7 @@ neighbour_connect_notify_task (void *cls,
783 } 778 }
784 n->reference_cnt++; 779 n->reference_cnt++;
785 h->cb (h->cb_cls, n->controller); 780 h->cb (h->cb_cls, n->controller);
781 GNUNET_free (h);
786} 782}
787 783
788static void 784static void
@@ -1014,6 +1010,8 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1014 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1010 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1015 return; 1011 return;
1016 } 1012 }
1013 GNUNET_CONFIGURATION_destroy (cfg);
1014 cfg = NULL;
1017 op_id = GNUNET_ntohll (msg->operation_id); 1015 op_id = GNUNET_ntohll (msg->operation_id);
1018 if (slave_host_id == GST_context->host_id) /* Link from us */ 1016 if (slave_host_id == GST_context->host_id) /* Link from us */
1019 { 1017 {
@@ -1073,7 +1071,6 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1073 GNUNET_TESTBED_controller_start (GST_context->master_ip, 1071 GNUNET_TESTBED_controller_start (GST_context->master_ip,
1074 GST_host_list[slave->host_id], 1072 GST_host_list[slave->host_id],
1075 &slave_status_callback, slave); 1073 &slave_status_callback, slave);
1076 GNUNET_CONFIGURATION_destroy (cfg);
1077 new_route = GNUNET_malloc (sizeof (struct Route)); 1074 new_route = GNUNET_malloc (sizeof (struct Route));
1078 new_route->dest = delegated_host_id; 1075 new_route->dest = delegated_host_id;
1079 new_route->thru = GST_context->host_id; 1076 new_route->thru = GST_context->host_id;
@@ -1097,7 +1094,6 @@ GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1097 GNUNET_assert (NULL != route); /* because we add routes carefully */ 1094 GNUNET_assert (NULL != route); /* because we add routes carefully */
1098 GNUNET_assert (route->dest < GST_slave_list_size); 1095 GNUNET_assert (route->dest < GST_slave_list_size);
1099 GNUNET_assert (NULL != GST_slave_list[route->dest]); 1096 GNUNET_assert (NULL != GST_slave_list[route->dest]);
1100 lcfq->lcf->cfg = cfg;
1101 lcfq->lcf->is_subordinate = msg->is_subordinate; 1097 lcfq->lcf->is_subordinate = msg->is_subordinate;
1102 lcfq->lcf->state = INIT; 1098 lcfq->lcf->state = INIT;
1103 lcfq->lcf->operation_id = op_id; 1099 lcfq->lcf->operation_id = op_id;
@@ -1155,8 +1151,6 @@ GST_free_lcfq ()
1155 for (lcfq = lcfq_head; NULL != lcfq; lcfq = lcfq_head) 1151 for (lcfq = lcfq_head; NULL != lcfq; lcfq = lcfq_head)
1156 { 1152 {
1157 GNUNET_SERVER_client_drop (lcfq->lcf->client); 1153 GNUNET_SERVER_client_drop (lcfq->lcf->client);
1158 GNUNET_assert (NULL != lcfq->lcf->cfg);
1159 GNUNET_CONFIGURATION_destroy (lcfq->lcf->cfg);
1160 GNUNET_free (lcfq->lcf); 1154 GNUNET_free (lcfq->lcf);
1161 GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq); 1155 GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq);
1162 GNUNET_free (lcfq); 1156 GNUNET_free (lcfq);