From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v7: Catch another case.
libs/vkd3d-shader/hlsl.y | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 1ab56fba..0fc8fa29 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -3208,7 +3208,10 @@ complex_initializer: { $$.args_count = 1; if (!($$.args = hlsl_alloc(ctx, sizeof(*$$.args)))) + { + destroy_instr_list($1); YYABORT; + } $$.args[0] = node_from_list($1); $$.instrs = $1; } @@ -3229,15 +3232,25 @@ initializer_expr_list: { $$.args_count = 1; if (!($$.args = hlsl_alloc(ctx, sizeof(*$$.args)))) + { + destroy_instr_list($1); YYABORT; + } $$.args[0] = node_from_list($1); $$.instrs = $1; } | initializer_expr_list ',' initializer_expr { + struct hlsl_ir_node **new_args; + $$ = $1; - if (!($$.args = hlsl_realloc(ctx, $$.args, ($$.args_count + 1) * sizeof(*$$.args)))) + if (!(new_args = hlsl_realloc(ctx, $$.args, ($$.args_count + 1) * sizeof(*$$.args)))) + { + free_parse_initializer(&$$); + destroy_instr_list($3); YYABORT; + } + $$.args = new_args; $$.args[$$.args_count++] = node_from_list($3); list_move_tail($$.instrs, $3); vkd3d_free($3);