avoid memory leak

This commit is contained in:
Ben Fry
2015-04-25 16:10:50 -04:00
parent 81345fd0cc
commit e0d500de86
+3 -2
View File
@@ -150,8 +150,9 @@ public class StringList implements Iterable<String> {
if (count == 0) {
throw new RuntimeException("Can't call pop() on an empty list");
}
String value = get(count-1);
count--;
count--; // back up to the last entry
String value = get(count);
data[count] = null; // avoid leak
return value;
}