diff options
author | Florian Dold <florian.dold@gmail.com> | 2013-08-12 15:16:15 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2013-08-12 15:16:15 +0000 |
commit | a345e89e5993856aa6780e24c0e580c10b50c4a1 (patch) | |
tree | b5b0c82a01a314acf5a8d7ca87f12d92e0e22bb6 | |
parent | 2bf579cafde4574b5f13f606926318e073fefc42 (diff) | |
download | gnunet-a345e89e5993856aa6780e24c0e580c10b50c4a1.tar.gz gnunet-a345e89e5993856aa6780e24c0e580c10b50c4a1.zip |
- test memory leak
-rw-r--r-- | src/util/container_multihashmap.c | 4 | ||||
-rw-r--r-- | src/util/test_container_multihashmap.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index 1cd699dff..9ef8f74a4 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -840,7 +840,7 @@ int | |||
840 | GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, | 840 | GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, |
841 | struct GNUNET_HashCode *key, const void **value) | 841 | struct GNUNET_HashCode *key, const void **value) |
842 | { | 842 | { |
843 | /* make sure nobody modified the map */ | 843 | /* make sure the map has not been modified */ |
844 | GNUNET_assert (iter->modification_counter == iter->map->modification_counter); | 844 | GNUNET_assert (iter->modification_counter == iter->map->modification_counter); |
845 | 845 | ||
846 | /* look for the next entry, skipping empty buckets */ | 846 | /* look for the next entry, skipping empty buckets */ |
@@ -883,7 +883,7 @@ GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMa | |||
883 | * @param iter the iterator to destroy | 883 | * @param iter the iterator to destroy |
884 | */ | 884 | */ |
885 | void | 885 | void |
886 | GNUNET_CONTAINER_multihashmap_enumerator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter) | 886 | GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter) |
887 | { | 887 | { |
888 | GNUNET_free (iter); | 888 | GNUNET_free (iter); |
889 | } | 889 | } |
diff --git a/src/util/test_container_multihashmap.c b/src/util/test_container_multihashmap.c index a0d29c606..6b079a109 100644 --- a/src/util/test_container_multihashmap.c +++ b/src/util/test_container_multihashmap.c | |||
@@ -87,6 +87,7 @@ testMap (int i) | |||
87 | CHECK (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, &key_ret, (const void **)&ret)); | 87 | CHECK (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, &key_ret, (const void **)&ret)); |
88 | CHECK (0 == memcmp (&key_ret, &k1, sizeof (key_ret))); | 88 | CHECK (0 == memcmp (&key_ret, &k1, sizeof (key_ret))); |
89 | CHECK (GNUNET_NO == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); | 89 | CHECK (GNUNET_NO == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); |
90 | GNUNET_free (iter); | ||
90 | 91 | ||
91 | CHECK (2 == GNUNET_CONTAINER_multihashmap_remove_all (m, &k1)); | 92 | CHECK (2 == GNUNET_CONTAINER_multihashmap_remove_all (m, &k1)); |
92 | for (j = 0; j < 1024; j++) | 93 | for (j = 0; j < 1024; j++) |
@@ -97,6 +98,7 @@ testMap (int i) | |||
97 | for (j = 0; j < GNUNET_CONTAINER_multihashmap_size (m); j++) | 98 | for (j = 0; j < GNUNET_CONTAINER_multihashmap_size (m); j++) |
98 | CHECK (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); | 99 | CHECK (GNUNET_YES == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); |
99 | CHECK (GNUNET_NO == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); | 100 | CHECK (GNUNET_NO == GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, NULL)); |
101 | GNUNET_free (iter); | ||
100 | 102 | ||
101 | GNUNET_CONTAINER_multihashmap_destroy (m); | 103 | GNUNET_CONTAINER_multihashmap_destroy (m); |
102 | return 0; | 104 | return 0; |