mirror of
https://github.com/ziglang/zig.git
synced 2025-12-26 08:03:08 +00:00
sema: Fix memory leak
When a generic call evaluates to a generic type, the call will be re-generated. However, the old function was not freed before being re-generated, causing a memory leak. So rather than only returning an error, we first free the old value.
This commit is contained in:
parent
9dc9219b2f
commit
79679be50d
@ -5068,6 +5068,7 @@ fn instantiateGenericCall(
|
||||
};
|
||||
const new_func_val = child_sema.resolveConstValue(&child_block, .unneeded, new_func_inst) catch unreachable;
|
||||
const new_func = new_func_val.castTag(.function).?.data;
|
||||
errdefer new_func.deinit(gpa);
|
||||
assert(new_func == new_module_func);
|
||||
|
||||
arg_i = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user