From 3df7c9bf54c7eebc11b2d67667cf6538a662124d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 18 Dec 2020 14:36:54 -0800 Subject: [PATCH] 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 Reviewed-by: Jesse Natalie Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/d3d12/d3d12_root_signature.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);