diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-19 14:01:18 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-19 14:01:18 +0000 |
commit | 9b3124e045a61865805b7a97f87700609cb926cb (patch) | |
tree | f46fae02dcdb3e007d9b1618ab1052420464a78a | |
parent | dc0da39a4d4a086b5286ae4705a3b96695d2f5f0 (diff) | |
download | gnunet-9b3124e045a61865805b7a97f87700609cb926cb.tar.gz gnunet-9b3124e045a61865805b7a97f87700609cb926cb.zip |
-fix sec_name leak
-rw-r--r-- | src/ats-tests/ats-testing-experiment.c | 20 | ||||
-rw-r--r-- | src/cadet/cadet_api.c | 22 | ||||
-rw-r--r-- | src/util/common_logging.c | 2 |
3 files changed, 29 insertions, 15 deletions
diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c index a6feee07c..b07d8fdcd 100644 --- a/src/ats-tests/ats-testing-experiment.c +++ b/src/ats-tests/ats-testing-experiment.c | |||
@@ -86,9 +86,11 @@ free_experiment (struct Experiment *e) | |||
86 | GNUNET_free (e); | 86 | GNUNET_free (e); |
87 | } | 87 | } |
88 | 88 | ||
89 | |||
89 | static int | 90 | static int |
90 | load_episode (struct Experiment *e, struct Episode *cur, | 91 | load_episode (struct Experiment *e, |
91 | struct GNUNET_CONFIGURATION_Handle *cfg) | 92 | struct Episode *cur, |
93 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
92 | { | 94 | { |
93 | struct GNUNET_ATS_TEST_Operation *o; | 95 | struct GNUNET_ATS_TEST_Operation *o; |
94 | char *sec_name; | 96 | char *sec_name; |
@@ -99,12 +101,12 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
99 | int op_counter = 0; | 101 | int op_counter = 0; |
100 | 102 | ||
101 | fprintf (stderr, "Parsing episode %u\n",cur->id); | 103 | fprintf (stderr, "Parsing episode %u\n",cur->id); |
102 | GNUNET_asprintf(&sec_name, "episode-%u", cur->id); | 104 | GNUNET_asprintf (&sec_name, "episode-%u", cur->id); |
103 | 105 | ||
104 | while (1) | 106 | while (1) |
105 | { | 107 | { |
106 | /* Load operation */ | 108 | /* Load operation */ |
107 | GNUNET_asprintf(&op_name, "op-%u-operation", op_counter); | 109 | GNUNET_asprintf (&op_name, "op-%u-operation", op_counter); |
108 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, | 110 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, |
109 | sec_name, op_name, &op)) | 111 | sec_name, op_name, &op)) |
110 | { | 112 | { |
@@ -136,6 +138,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
136 | GNUNET_free (op); | 138 | GNUNET_free (op); |
137 | GNUNET_free (op_name); | 139 | GNUNET_free (op_name); |
138 | GNUNET_free (o); | 140 | GNUNET_free (o); |
141 | GNUNET_free (sec_name); | ||
139 | return GNUNET_SYSERR; | 142 | return GNUNET_SYSERR; |
140 | } | 143 | } |
141 | GNUNET_free (op_name); | 144 | GNUNET_free (op_name); |
@@ -150,6 +153,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
150 | GNUNET_free (op); | 153 | GNUNET_free (op); |
151 | GNUNET_free (op_name); | 154 | GNUNET_free (op_name); |
152 | GNUNET_free (o); | 155 | GNUNET_free (o); |
156 | GNUNET_free (sec_name); | ||
153 | return GNUNET_SYSERR; | 157 | return GNUNET_SYSERR; |
154 | } | 158 | } |
155 | if (o->src_id > (e->num_masters - 1)) | 159 | if (o->src_id > (e->num_masters - 1)) |
@@ -159,6 +163,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
159 | GNUNET_free (op); | 163 | GNUNET_free (op); |
160 | GNUNET_free (op_name); | 164 | GNUNET_free (op_name); |
161 | GNUNET_free (o); | 165 | GNUNET_free (o); |
166 | GNUNET_free (sec_name); | ||
162 | return GNUNET_SYSERR; | 167 | return GNUNET_SYSERR; |
163 | } | 168 | } |
164 | GNUNET_free (op_name); | 169 | GNUNET_free (op_name); |
@@ -173,6 +178,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
173 | GNUNET_free (op); | 178 | GNUNET_free (op); |
174 | GNUNET_free (op_name); | 179 | GNUNET_free (op_name); |
175 | GNUNET_free (o); | 180 | GNUNET_free (o); |
181 | GNUNET_free (sec_name); | ||
176 | return GNUNET_SYSERR; | 182 | return GNUNET_SYSERR; |
177 | } | 183 | } |
178 | if (o->dest_id > (e->num_slaves - 1)) | 184 | if (o->dest_id > (e->num_slaves - 1)) |
@@ -182,6 +188,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
182 | GNUNET_free (op); | 188 | GNUNET_free (op); |
183 | GNUNET_free (op_name); | 189 | GNUNET_free (op_name); |
184 | GNUNET_free (o); | 190 | GNUNET_free (o); |
191 | GNUNET_free (sec_name); | ||
185 | return GNUNET_SYSERR; | 192 | return GNUNET_SYSERR; |
186 | } | 193 | } |
187 | GNUNET_free (op_name); | 194 | GNUNET_free (op_name); |
@@ -252,6 +259,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
252 | GNUNET_free (op_name); | 259 | GNUNET_free (op_name); |
253 | GNUNET_free (op); | 260 | GNUNET_free (op); |
254 | GNUNET_free (o); | 261 | GNUNET_free (o); |
262 | GNUNET_free (sec_name); | ||
255 | return GNUNET_SYSERR; | 263 | return GNUNET_SYSERR; |
256 | } | 264 | } |
257 | } | 265 | } |
@@ -279,6 +287,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
279 | GNUNET_free (op_name); | 287 | GNUNET_free (op_name); |
280 | GNUNET_free (op); | 288 | GNUNET_free (op); |
281 | GNUNET_free (o); | 289 | GNUNET_free (o); |
290 | GNUNET_free (sec_name); | ||
282 | return GNUNET_SYSERR; | 291 | return GNUNET_SYSERR; |
283 | } | 292 | } |
284 | GNUNET_free (op_name); | 293 | GNUNET_free (op_name); |
@@ -295,6 +304,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
295 | GNUNET_free (op); | 304 | GNUNET_free (op); |
296 | GNUNET_free_non_null (pref); | 305 | GNUNET_free_non_null (pref); |
297 | GNUNET_free (o); | 306 | GNUNET_free (o); |
307 | GNUNET_free (sec_name); | ||
298 | return GNUNET_SYSERR; | 308 | return GNUNET_SYSERR; |
299 | } | 309 | } |
300 | 310 | ||
@@ -312,6 +322,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
312 | GNUNET_free (pref); | 322 | GNUNET_free (pref); |
313 | GNUNET_free_non_null (pref); | 323 | GNUNET_free_non_null (pref); |
314 | GNUNET_free (o); | 324 | GNUNET_free (o); |
325 | GNUNET_free (sec_name); | ||
315 | return GNUNET_SYSERR; | 326 | return GNUNET_SYSERR; |
316 | } | 327 | } |
317 | GNUNET_free (pref); | 328 | GNUNET_free (pref); |
@@ -352,6 +363,7 @@ load_episode (struct Experiment *e, struct Episode *cur, | |||
352 | return GNUNET_OK; | 363 | return GNUNET_OK; |
353 | } | 364 | } |
354 | 365 | ||
366 | |||
355 | static int | 367 | static int |
356 | load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) | 368 | load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg) |
357 | { | 369 | { |
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 | |||
526 | timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 526 | timeout_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; |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index aebfc504a..5faa4af73 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1095,7 +1095,7 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | |||
1095 | { | 1095 | { |
1096 | static char buf[256]; | 1096 | static char buf[256]; |
1097 | char *ret; | 1097 | char *ret; |
1098 | 1098 | ||
1099 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); | 1099 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); |
1100 | strcpy (buf, ret); | 1100 | strcpy (buf, ret); |
1101 | GNUNET_free (ret); | 1101 | GNUNET_free (ret); |