spirv2dxil: Fix memory leak on error path.

Fix resource leak reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable file_contents going out of scope leaks the storage it points to.

Fixes: 531d17c334 ("spirv2dxil: Support linking multiple shaders")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20576>
This commit is contained in:
Vinson Lee
2023-01-08 11:53:57 -08:00
committed by Marge Bot
parent 9b29876a02
commit 84527093c4

View File

@@ -92,6 +92,7 @@ compile_shader(const char *filename, gl_shader_stage shader_stage, struct shader
if (file_size % WORD_SIZE != 0) {
fprintf(stderr, "%s size == %zu is not a multiple of %d\n", filename,
file_size, WORD_SIZE);
free(file_contents);
return false;
}