Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.c:
- hlsl_block_init(&c->body);
- if (body)
hlsl_block_add_block(&c->body, body);
- c->loc = *loc;
- return c;
+}
+struct hlsl_ir_node *hlsl_new_switch(struct hlsl_ctx *ctx, struct hlsl_ir_node *selector,
struct list *cases, const struct vkd3d_shader_location *loc)
+{
- struct hlsl_ir_switch *s;
- if (!(s = hlsl_alloc(ctx, sizeof(*s))))
return NULL;
This has a similar problem to `hlsl_new_switch_case()`: if you return here the content of `cases` is leaked.