Skip to content
Snippets Groups Projects
Commit daddfe83 authored by Elizabeth Figura's avatar Elizabeth Figura
Browse files

vkd3d-shader/d3dbc: Return ctx->result from hlsl_sm1_write().

parent 83265844
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !288. Comments created here will be created in the context of that merge request.
......@@ -2442,7 +2442,6 @@ static void write_sm1_instructions(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
int hlsl_sm1_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, struct vkd3d_shader_code *out)
{
struct vkd3d_bytecode_buffer buffer = {0};
int ret;
put_u32(&buffer, sm1_version(ctx->profile->type, ctx->profile->major_version, ctx->profile->minor_version));
......@@ -2455,10 +2454,13 @@ int hlsl_sm1_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun
put_u32(&buffer, D3DSIO_END);
if (!(ret = buffer.status))
if (buffer.status)
ctx->result = buffer.status;
if (!ctx->result)
{
out->code = buffer.data;
out->size = buffer.size;
}
return ret;
return ctx->result;
  • Developer

    Wouldn't we be leaking buffer.data in case ctx->result != 0, but buffer.status = 0 ?

  • Author Developer

    Wouldn't we be leaking buffer.data in case ctx->result != 0, but buffer.status = 0 ?

    Yes, in fact we're leaking it either way; if allocation fails the existing memory is not freed, so this was already a problem. I'll add a patch to fix it.

  • Please register or sign in to reply
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment