mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
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> (cherry picked from commita2ee293422)
This commit is contained in:
parent
e202645c9f
commit
4ebf0d11c2
2 changed files with 6 additions and 4 deletions
|
|
@ -3901,7 +3901,7 @@
|
|||
"description": "zink: Check fopen result.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "8d46e35d16e3936968958bcab86d61967a673305"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -277,9 +277,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…
Add table
Reference in a new issue