diff options
author | Vinson Lee <vlee@freedesktop.org> | 2020-12-17 17:29:13 -0800 |
---|---|---|
committer | Vinson Lee <vlee@freedesktop.org> | 2020-12-20 15:18:03 -0800 |
commit | 1ff5463ff83c0a5f6ea6be56056852318bc12d8c (patch) | |
tree | 2321cd6b2465865d7b333946546c3da8aedb2852 | |
parent | f9ceab7b237d40ded7728457114e59ca6707dd71 (diff) |
d3d12: Fix memory leak if create_gfx_pipeline_state failed.
Fix defect reported by Coverity Scan.
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable data going out of scope leaks the storage it points to.
Fixes: 2ea15cd661c ("d3d12: introduce d3d12 gallium driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8150>
-rw-r--r-- | src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp index abea496023f..3d9e7aa6a74 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp @@ -312,8 +312,10 @@ d3d12_get_gfx_pipeline_state(struct d3d12_context *ctx) data->key = ctx->gfx_pipeline_state; data->pso = create_gfx_pipeline_state(ctx); - if (!data->pso) + if (!data->pso) { + FREE(data); return NULL; + } entry = _mesa_hash_table_insert_pre_hashed(ctx->pso_cache, hash, &data->key, data); assert(entry); |