[libgee] Fix memory leak in LinkedList.clear
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgee] Fix memory leak in LinkedList.clear
- Date: Fri, 28 Jan 2011 17:32:49 +0000 (UTC)
commit fead26c06f5667b72cecd41ee4bcc81908dfc12a
Author: Jürg Billeter <j bitron ch>
Date: Fri Jan 28 18:28:49 2011 +0100
Fix memory leak in LinkedList.clear
Based on patch by Travis Reitter, fixes bug 639254.
gee/linkedlist.vala | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index cc64f0b..9cb2d0b 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 ();
}
/**
@@ -136,6 +135,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]