Commit 9fe38355 authored by Vinson Lee's avatar Vinson Lee
Browse files

d3d12: Fix memory leaks on error paths in d3d12_context_create.

Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable ctx going out of scope leaks the storage
it points to.

Fixes: 2ea15cd6

 ("d3d12: introduce d3d12 gallium driver")
Signed-off-by: Vinson Lee's avatarVinson Lee <vlee@freedesktop.org>
parent 9f213238
Pipeline #250109 waiting for manual action with stages
in 9 seconds
......@@ -1931,6 +1931,7 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->primconvert = util_primconvert_create_config(&ctx->base, &cfg);
if (!ctx->primconvert) {
debug_printf("D3D12: failed to create primconvert\n");
FREE(ctx);
return NULL;
}
......@@ -1941,6 +1942,7 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
util_dl_library *d3d12_mod = util_dl_open(UTIL_DL_PREFIX "d3d12" UTIL_DL_EXT);
if (!d3d12_mod) {
debug_printf("D3D12: failed to load D3D12.DLL\n");
FREE(ctx);
return NULL;
}
ctx->D3D12SerializeVersionedRootSignature =
......@@ -2000,8 +2002,10 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->validation_tools = d3d12_validator_create();
ctx->blitter = util_blitter_create(&ctx->base);
if (!ctx->blitter)
if (!ctx->blitter) {
FREE(ctx);
return NULL;
}
ctx->resource_state_manager = new ResourceStateManager();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment