diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 9c8f70c11224..a7db3704bbaf 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -787,8 +787,9 @@ when defined(gcDestructors): while it != nil: if maxIters == 0: let rest = it.next.loada - it.next.storea nil - addToSharedFreeList(c, rest) + if rest != nil: + it.next.storea nil + addToSharedFreeList(c, rest) break inc x, size it = it.next.loada