in new_struct_to_str, fix uaf

This commit is contained in:
Walther Chen
2024-12-17 16:15:24 +07:00
committed by Christoffer Lerno
parent 4ae3d0150f
commit c13cdcdd36

View File

@@ -757,8 +757,8 @@ macro String new_struct_to_str(x, Allocator allocator = allocator::heap())
{
s.new_init(allocator: mem);
io::fprint(&s, x)!!;
return s.copy_str(allocator);
};
return s.copy_str(allocator);
}
macro String temp_struct_to_str(x) => new_struct_to_str(x, allocator::temp());
macro String temp_struct_to_str(x) => new_struct_to_str(x, allocator::temp());