From: Karel Zak Date: Fri, 10 Dec 2021 15:22:07 +0000 (+0100) Subject: libblkid: check blkid_get_cache() return value [coverity scan] X-Git-Tag: v2.38-rc1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0aa42a8107d023e2cf4898d7ad205650ca4524f0;p=thirdparty%2Futil-linux.git libblkid: check blkid_get_cache() return value [coverity scan] CID 374488: Error handling issues (CHECKED_RETURN) Calling "blkid_get_cache" without checking return value (as is done elsewhere 4 out of 5 times). It's probably unnecessary as we check the cache pointer later, but let's make it more robust for static analyzers. Signed-off-by: Karel Zak --- diff --git a/libblkid/src/evaluate.c b/libblkid/src/evaluate.c index 710eac9566..8157a7cca6 100644 --- a/libblkid/src/evaluate.c +++ b/libblkid/src/evaluate.c @@ -200,8 +200,10 @@ static char *evaluate_by_scan(const char *token, const char *value, if (!c) { char *cachefile = blkid_get_cache_filename(conf); - blkid_get_cache(&c, cachefile); + int rc = blkid_get_cache(&c, cachefile); free(cachefile); + if (rc < 0) + return NULL; } if (!c) return NULL;