1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

autofree: do not free tmp vars twice

This commit is contained in:
Alexander Medvednikov 2020-10-31 08:26:54 +01:00
parent 70cbf56655
commit b59c5fd82b

View File

@ -1971,6 +1971,9 @@ fn (mut g Gen) autofree_var_call(free_fn_name string, v ast.Var) {
// tmp expr vars do not need to be freed again here
return
}
if v.is_autofree_tmp {
return
}
if v.typ.is_ptr() {
g.writeln('\t${free_fn_name}(${c_name(v.name)}); // autofreed ptr var')
} else {