Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
YYABORT;
vkd3d_free($8);
$$ = $5;
hlsl_block_add_instr($$, s);
}
+switch_case:
KW_CASE expr ':' statement_list
{
struct hlsl_ir_switch_case *c;
if (!(c = hlsl_new_switch_case(ctx, $2, $4, &@2)))
YYABORT;
$$ = &c->entry;
destroy_block($2);
I think you have to destroy `$4` too. Function `hlsl_new_switch_case()` leaves it empty (though not always, see above), but the block itself is allocated on the heap here, so you have to free it. `destroy_block()` cares about that. This also applies to the other `case` and `default` rules.