zink: Check fopen result.
Fix warning reported by Coverity.
Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL fp when calling
fwrite.
Fixes: 8d46e35d16
("zink: introduce opengl over vulkan")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5235>
This commit is contained in:
parent
7503863fe2
commit
a2ee293422
|
@ -195,9 +195,11 @@ zink_compile_nir(struct zink_screen *screen, struct nir_shader *nir)
|
|||
static int i;
|
||||
snprintf(buf, sizeof(buf), "dump%02d.spv", i++);
|
||||
FILE *fp = fopen(buf, "wb");
|
||||
fwrite(spirv->words, sizeof(uint32_t), spirv->num_words, fp);
|
||||
fclose(fp);
|
||||
fprintf(stderr, "wrote '%s'...\n", buf);
|
||||
if (fp) {
|
||||
fwrite(spirv->words, sizeof(uint32_t), spirv->num_words, fp);
|
||||
fclose(fp);
|
||||
fprintf(stderr, "wrote '%s'...\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
VkShaderModuleCreateInfo smci = {};
|
||||
|
|
Loading…
Reference in New Issue