summaryrefslogtreecommitdiff
path: root/gee/hashmap.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2009-06-01 22:53:34 +0200
committerJürg Billeter <j@bitron.ch>2009-06-01 22:53:34 +0200
commit0f54f1d182d262f6b328642de4507c7ec900c2b6 (patch)
tree2f20c10e90057fa21411f55510f0318b603c4d84 /gee/hashmap.vala
parentdec60546c7d6a794a3090da58ab361ab5ee9d448 (diff)
downloadvala-0f54f1d182d262f6b328642de4507c7ec900c2b6.tar.gz
gee: Fix memory leak in HashMap.remove and HashSet.remove
Fixes bug 584440.
Diffstat (limited to 'gee/hashmap.vala')
-rw-r--r--gee/hashmap.vala7
1 files changed, 6 insertions, 1 deletions
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 740c40968..67b08ba91 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -113,9 +113,14 @@ public class Gee.HashMap<K,V> : CollectionObject, Map<K,V> {
public bool remove (K key) {
Node<K,V>** node = lookup_node (key);
if (*node != null) {
+ Node<K,V> next = (owned) (*node)->next;
+
(*node)->key = null;
(*node)->value = null;
- *node = (*node)->next;
+ delete *node;
+
+ *node = (owned) next;
+
_nnodes--;
resize ();
_stamp++;