Skip to content

Commit dc1d091

Browse files
committed
builtin: support -d builtin_free_nop to help diagnose problems with too early manual free() calls
1 parent 194db24 commit dc1d091

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎vlib/builtin/builtin.c.v‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ pub fn free(ptr voidptr) {
680680
$if trace_free ? {
681681
C.fprintf(C.stderr, c'free ptr: %p\n', ptr)
682682
}
683+
$if builtin_free_nop ? {
684+
return
685+
}
683686
if ptr == unsafe { 0 } {
684687
$if trace_free_nulls ? {
685688
C.fprintf(C.stderr, c'free null ptr\n', ptr)

0 commit comments

Comments
 (0)