From 6b436146a8065b3e19c11359df85a44dac269730 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 25 Feb 2018 20:28:44 -0500 Subject: fix invalid memory write in coroutines implementation --- src/ir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index b3f53f824d..5c5bfc3cd1 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -942,7 +942,7 @@ static IrInstruction *ir_build_const_promise_init(IrBuilder *irb, Scope *scope, IrInstructionConst *const_instruction = ir_build_instruction(irb, scope, source_node); const_instruction->base.value.type = struct_type; const_instruction->base.value.special = ConstValSpecialStatic; - const_instruction->base.value.data.x_struct.fields = allocate(2); + const_instruction->base.value.data.x_struct.fields = allocate(field_count); const_instruction->base.value.data.x_struct.fields[0].type = awaiter_handle_type; const_instruction->base.value.data.x_struct.fields[0].special = ConstValSpecialStatic; const_instruction->base.value.data.x_struct.fields[0].data.x_maybe = nullptr; -- cgit v1.2.3