summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinson Lee <vlee@freedesktop.org>2020-12-18 14:36:54 -0800
committerMarge Bot <eric+marge@anholt.net>2020-12-20 23:33:20 +0000
commit3df7c9bf54c7eebc11b2d67667cf6538a662124d (patch)
tree8da25e57f98839e9b3411fa994667329eed01739
parent1ff5463ff83c0a5f6ea6be56056852318bc12d8c (diff)
d3d12: Fix memory leak if create_root_signature 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 <kusmabite@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8170>
-rw-r--r--src/gallium/drivers/d3d12/d3d12_root_signature.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/d3d12/d3d12_root_signature.cpp b/src/gallium/drivers/d3d12/d3d12_root_signature.cpp
index ae69c9e8a4a..be050140e66 100644
--- a/src/gallium/drivers/d3d12/d3d12_root_signature.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_root_signature.cpp
@@ -211,8 +211,10 @@ d3d12_get_root_signature(struct d3d12_context *ctx)
data->key = key;
data->sig = create_root_signature(ctx, &key);
- if (!data->sig)
+ if (!data->sig) {
+ FREE(data);
return NULL;
+ }
entry = _mesa_hash_table_insert(ctx->root_signature_cache, &data->key, data);
assert(entry);