diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-26 11:38:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-26 11:38:34 +0000 |
commit | 6a80e00bda6d07527d0a6adf5812801a57bdf2f0 (patch) | |
tree | 076b1bc3a2b334e43e36feaea283990c65705540 /src/consensus | |
parent | 781ee14af864a6c261ae8e041c5cb5197892216c (diff) |
fix consensus memory leaks
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 74035b46b2..64decc29e5 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c @@ -1758,7 +1758,10 @@ task_start_apply_round (struct TaskEntry *task) iter = GNUNET_CONTAINER_multihashmap_iterator_create (rfn_in->rfn_elements); - while (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ri)) + while (GNUNET_YES == + GNUNET_CONTAINER_multihashmap_iterator_next (iter, + NULL, + (const void **) &ri)) { uint16_t majority_num; enum ReferendumVote majority_vote; @@ -1775,7 +1778,7 @@ task_start_apply_round (struct TaskEntry *task) GNUNET_assert (GNUNET_OK == GNUNET_SET_add_element (set_out->h, ri->element, - set_mutation_done, + &set_mutation_done, progress_cls)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: apply round: adding element %s with %u-majority.\n", @@ -1787,7 +1790,7 @@ task_start_apply_round (struct TaskEntry *task) GNUNET_assert (GNUNET_OK == GNUNET_SET_remove_element (set_out->h, ri->element, - set_mutation_done, + &set_mutation_done, progress_cls)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "P%u: apply round: deleting element %s with %u-majority.\n", @@ -1807,7 +1810,7 @@ task_start_apply_round (struct TaskEntry *task) } } - if (progress_cls->num_pending == 0) + if (0 == progress_cls->num_pending) { // call closure right now, no pending ops GNUNET_free (progress_cls); @@ -1858,7 +1861,7 @@ task_start_apply_round (struct TaskEntry *task) session->local_peer_idx); } } - + GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); } @@ -1896,7 +1899,10 @@ task_start_grade (struct TaskEntry *task) apply_diff_to_rfn (input_diff, output_rfn, task->key.leader, session->num_peers); - while (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ri)) + while (GNUNET_YES == + GNUNET_CONTAINER_multihashmap_iterator_next (iter, + NULL, + (const void **) &ri)) { uint16_t majority_num; enum ReferendumVote majority_vote; @@ -1922,6 +1928,7 @@ task_start_grade (struct TaskEntry *task) break; } } + GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); { uint16_t noncontested; @@ -2158,7 +2165,7 @@ task_start_eval_echo (struct TaskEntry *task) GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); - if (progress_cls->num_pending == 0) + if (0 == progress_cls->num_pending) { // call closure right now, no pending ops GNUNET_free (progress_cls); |