aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2020-02-02 17:15:09 +0000
committerMarge Bot <[email protected]>2020-02-05 01:09:04 +0000
commit2799676218249c5b9f1dc0a6367e459a1ad5642e (patch)
tree32804d8779b8d7311488d3d25f250b2b9cd064fb
parent6321e3fb9fd9cc9d817071d435c6b8a59869b8bc (diff)
util/disk_cache: check for write() failure in the zstd path
CoverityID: 1458074 Fixes: a8d941091f72923561a6 ("util: Use ZSTD for shader cache if possible") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3672> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3672>
-rw-r--r--src/util/disk_cache.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index e5b21b9a79f..d1f14736725 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -758,7 +758,11 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
free(out);
return 0;
}
- write_all(dest, out, ret);
+ ssize_t written = write_all(dest, out, ret);
+ if (written == -1) {
+ free(out);
+ return 0;
+ }
free(out);
return ret;
#else