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_ir_node *ret;
- 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);
This can fail. Notice, in particular, that it calls `vkd3d_array_reserve()`, which doesn't set an error in the context if allocation failed. So you genuinely need to check the result here, you cannot rely on the context being implicitly marked as failed.