summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2011-01-28 18:28:49 +0100
committerJürg Billeter <j@bitron.ch>2011-01-28 18:28:49 +0100
commit6dfd9bcdf5fc142d2bbc751bd1e8bc4f52f73f4a (patch)
tree1f7f883cd6ed96986d8a966bc7833993c8e59f57
parentb004e916eff71621ce4f635f8ef683253eb9721e (diff)
downloadlibgee-6dfd9bcdf5fc142d2bbc751bd1e8bc4f52f73f4a.tar.gz
Fix memory leak in LinkedList.clear
Based on patch by Travis Reitter, fixes bug 639254.
-rw-r--r--gee/linkedlist.vala7
1 files changed, 5 insertions, 2 deletions
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index fafecc7..5c9cfd3 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -59,8 +59,7 @@ public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
}
~LinkedList () {
- while (_head != null)
- _remove_node (_head);
+ this.clear ();
}
/**
@@ -129,6 +128,10 @@ public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
* {@inheritDoc}
*/
public override void clear () {
+ while (_head != null) {
+ _remove_node (_head);
+ }
+
++this._stamp;
this._head = null;
this._tail = null;