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/gnunet-service-consensus.c | |
parent | 781ee14af864a6c261ae8e041c5cb5197892216c (diff) | |
download | gnunet-6a80e00bda6d07527d0a6adf5812801a57bdf2f0.tar.gz gnunet-6a80e00bda6d07527d0a6adf5812801a57bdf2f0.zip |
fix consensus memory leaks
Diffstat (limited to 'src/consensus/gnunet-service-consensus.c')
-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 74035b46b..64decc29e 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) | |||
1758 | 1758 | ||
1759 | iter = GNUNET_CONTAINER_multihashmap_iterator_create (rfn_in->rfn_elements); | 1759 | iter = GNUNET_CONTAINER_multihashmap_iterator_create (rfn_in->rfn_elements); |
1760 | 1760 | ||
1761 | while (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ri)) | 1761 | while (GNUNET_YES == |
1762 | GNUNET_CONTAINER_multihashmap_iterator_next (iter, | ||
1763 | NULL, | ||
1764 | (const void **) &ri)) | ||
1762 | { | 1765 | { |
1763 | uint16_t majority_num; | 1766 | uint16_t majority_num; |
1764 | enum ReferendumVote majority_vote; | 1767 | enum ReferendumVote majority_vote; |
@@ -1775,7 +1778,7 @@ task_start_apply_round (struct TaskEntry *task) | |||
1775 | GNUNET_assert (GNUNET_OK == | 1778 | GNUNET_assert (GNUNET_OK == |
1776 | GNUNET_SET_add_element (set_out->h, | 1779 | GNUNET_SET_add_element (set_out->h, |
1777 | ri->element, | 1780 | ri->element, |
1778 | set_mutation_done, | 1781 | &set_mutation_done, |
1779 | progress_cls)); | 1782 | progress_cls)); |
1780 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1783 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1781 | "P%u: apply round: adding element %s with %u-majority.\n", | 1784 | "P%u: apply round: adding element %s with %u-majority.\n", |
@@ -1787,7 +1790,7 @@ task_start_apply_round (struct TaskEntry *task) | |||
1787 | GNUNET_assert (GNUNET_OK == | 1790 | GNUNET_assert (GNUNET_OK == |
1788 | GNUNET_SET_remove_element (set_out->h, | 1791 | GNUNET_SET_remove_element (set_out->h, |
1789 | ri->element, | 1792 | ri->element, |
1790 | set_mutation_done, | 1793 | &set_mutation_done, |
1791 | progress_cls)); | 1794 | progress_cls)); |
1792 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1795 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1793 | "P%u: apply round: deleting element %s with %u-majority.\n", | 1796 | "P%u: apply round: deleting element %s with %u-majority.\n", |
@@ -1807,7 +1810,7 @@ task_start_apply_round (struct TaskEntry *task) | |||
1807 | } | 1810 | } |
1808 | } | 1811 | } |
1809 | 1812 | ||
1810 | if (progress_cls->num_pending == 0) | 1813 | if (0 == progress_cls->num_pending) |
1811 | { | 1814 | { |
1812 | // call closure right now, no pending ops | 1815 | // call closure right now, no pending ops |
1813 | GNUNET_free (progress_cls); | 1816 | GNUNET_free (progress_cls); |
@@ -1858,7 +1861,7 @@ task_start_apply_round (struct TaskEntry *task) | |||
1858 | session->local_peer_idx); | 1861 | session->local_peer_idx); |
1859 | } | 1862 | } |
1860 | } | 1863 | } |
1861 | 1864 | GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); | |
1862 | } | 1865 | } |
1863 | 1866 | ||
1864 | 1867 | ||
@@ -1896,7 +1899,10 @@ task_start_grade (struct TaskEntry *task) | |||
1896 | 1899 | ||
1897 | apply_diff_to_rfn (input_diff, output_rfn, task->key.leader, session->num_peers); | 1900 | apply_diff_to_rfn (input_diff, output_rfn, task->key.leader, session->num_peers); |
1898 | 1901 | ||
1899 | while (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ri)) | 1902 | while (GNUNET_YES == |
1903 | GNUNET_CONTAINER_multihashmap_iterator_next (iter, | ||
1904 | NULL, | ||
1905 | (const void **) &ri)) | ||
1900 | { | 1906 | { |
1901 | uint16_t majority_num; | 1907 | uint16_t majority_num; |
1902 | enum ReferendumVote majority_vote; | 1908 | enum ReferendumVote majority_vote; |
@@ -1922,6 +1928,7 @@ task_start_grade (struct TaskEntry *task) | |||
1922 | break; | 1928 | break; |
1923 | } | 1929 | } |
1924 | } | 1930 | } |
1931 | GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); | ||
1925 | 1932 | ||
1926 | { | 1933 | { |
1927 | uint16_t noncontested; | 1934 | uint16_t noncontested; |
@@ -2158,7 +2165,7 @@ task_start_eval_echo (struct TaskEntry *task) | |||
2158 | 2165 | ||
2159 | GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); | 2166 | GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); |
2160 | 2167 | ||
2161 | if (progress_cls->num_pending == 0) | 2168 | if (0 == progress_cls->num_pending) |
2162 | { | 2169 | { |
2163 | // call closure right now, no pending ops | 2170 | // call closure right now, no pending ops |
2164 | GNUNET_free (progress_cls); | 2171 | GNUNET_free (progress_cls); |