Fixed infinite loop in freeList() which caused valgrind to fail.