From: Eric Engestrom Date: Sun, 2 Feb 2020 17:15:09 +0000 (+0000) Subject: util/disk_cache: check for write() failure in the zstd path X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2799676218249c5b9f1dc0a6367e459a1ad5642e;p=mesa.git 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 Reviewed-by: Dylan Baker Tested-by: Marge Bot Part-of: --- 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