mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
autofree: only free user reference types
This commit is contained in:
parent
6d47dd22df
commit
219a764a83
@ -3243,7 +3243,8 @@ fn (mut g Gen) autofree_variable(v ast.Var) {
|
|||||||
}
|
}
|
||||||
if sym.has_method('free') {
|
if sym.has_method('free') {
|
||||||
g.autofree_var_call(c_name(sym.name) + '_free', v)
|
g.autofree_var_call(c_name(sym.name) + '_free', v)
|
||||||
} else if v.typ.is_real_pointer() {
|
} else if v.typ.is_ptr() && sym.name.after('.')[0].is_capital() {
|
||||||
|
// Free user reference types
|
||||||
g.autofree_var_call('free', v)
|
g.autofree_var_call('free', v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user