diff --git a/src/gc.c b/src/gc.c index 72190d00..1c9fddef 100644 --- a/src/gc.c +++ b/src/gc.c @@ -449,12 +449,12 @@ gc_sweep_phase(pic_state *pic) for (p = bp + bp->s.size; p != bp->s.ptr; p += p->s.size) { if (! gc_is_marked(p)) { if (s == NULL) { - s = t = p; + s = p; } else { t->s.ptr = p; - t = t->s.ptr; } + t = p; t->s.ptr = NULL; /* For dead objects we can safely reuse ptr field */ } gc_unmark(p);