Sema: fix memory leak in zirTypeInfo

This commit is contained in:
Andrew Kelley 2023-11-04 21:59:35 -07:00
parent dc63426b1e
commit 33644546a0

View File

@ -17627,7 +17627,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const name = if (struct_type.fieldName(ip, i).unwrap()) |name_nts| const name = if (struct_type.fieldName(ip, i).unwrap()) |name_nts|
try sema.arena.dupe(u8, ip.stringToSlice(name_nts)) try sema.arena.dupe(u8, ip.stringToSlice(name_nts))
else else
try std.fmt.allocPrintZ(gpa, "{d}", .{i}); try std.fmt.allocPrintZ(sema.arena, "{d}", .{i});
const field_ty = struct_type.field_types.get(ip)[i].toType(); const field_ty = struct_type.field_types.get(ip)[i].toType();
const field_init = struct_type.fieldInit(ip, i); const field_init = struct_type.fieldInit(ip, i);
const field_is_comptime = struct_type.fieldIsComptime(ip, i); const field_is_comptime = struct_type.fieldIsComptime(ip, i);