Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.c:
+static struct hlsl_ir_node *clone_switch(struct hlsl_ctx *ctx,
struct clone_instr_map *map, struct hlsl_ir_switch *s)
+{
- struct hlsl_ir_switch_case *c, *d;
- struct hlsl_block body;
- struct list cases;
- list_init(&cases);
- LIST_FOR_EACH_ENTRY(c, &s->cases, struct hlsl_ir_switch_case, entry)
- {
clone_block(ctx, &body, &c->body, map);
if (!(d = hlsl_new_switch_case(ctx, NULL, &body, &c->loc)))
return NULL;
You need to cleanup if `clone_block()` or `hlsl_new_switch_case()` fail.