Skip to content

Commit b8c649b

Browse files
authored
builtin: small cleanup in array.free() (make debugging easier) (#22173)
1 parent 625e4df commit b8c649b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vlib/builtin/array.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,12 @@ pub fn (a &array) free() {
766766
return
767767
}
768768
mblock_ptr := &u8(u64(a.data) - u64(a.offset))
769-
unsafe { free(mblock_ptr) }
769+
if mblock_ptr != unsafe { nil } {
770+
unsafe { free(mblock_ptr) }
771+
}
770772
unsafe {
771773
a.data = nil
774+
a.offset = 0
772775
}
773776
}
774777

0 commit comments

Comments
 (0)