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: 2ea15cd661 ("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>
This commit is contained in:
Vinson Lee 2020-12-17 17:29:13 -08:00
parent f9ceab7b23
commit 1ff5463ff8

View file

@ -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);