Mesa (master): d3d12: Fix memory leak if create_gfx_pipeline_state failed.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Dec 20 23:32:27 UTC 2020
Module: Mesa
Branch: master
Commit: 1ff5463ff83c0a5f6ea6be56056852318bc12d8c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ff5463ff83c0a5f6ea6be56056852318bc12d8c
Author: Vinson Lee <vlee at freedesktop.org>
Date: Thu Dec 17 17:29:13 2020 -0800
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 at freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8150>
---
src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
More information about the mesa-commit
mailing list