Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/ir.c:
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
assert(!cf_info->inside_block);
if (!cf_info->u.switch_.default_block_id)
cf_info->u.switch_.default_block_id = cf_info->u.switch_.merge_block_id;
cf_flattener_emit_label(flattener, cf_info->u.switch_.merge_block_id);
/* The SWITCH instruction is completed when the endswitch
* instruction is processed because we do not know the number
* of case statements or the default block id in advance.*/
dst_ins = &flattener->instructions[cf_info->u.switch_.ins_location];
dst_ins->declaration.switch_.cases = cf_info->u.switch_.cases;
dst_ins->declaration.switch_.case_count = cf_info->u.switch_.cases_count;
dst_ins->declaration.switch_.default_id = cf_info->u.switch_.default_block_id;
shader_instruction_array_add_opaque_param(instructions, cf_info->u.switch_.cases);
I guess you should check the result here, because if allocation failed inside `shader_instruction_array_add_opaque_param()` you're going to leak `cases`.