From: Diego Biurrun Date: Sun, 27 Apr 2014 21:23:49 +0000 (+0200) Subject: opencl: Check return value of fread() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c15f20bd772487d863f01a2813a3ab45b1f11a6b;p=libx264 opencl: Check return value of fread() common/opencl.c:138:10: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] --- diff --git a/common/opencl.c b/common/opencl.c index 9e5e7941..8b223b4c 100644 --- a/common/opencl.c +++ b/common/opencl.c @@ -135,7 +135,8 @@ static cl_program x264_opencl_cache_load( x264_t *h, const char *dev_name, const rewind( fp ); CHECKED_MALLOC( binary, size ); - fread( binary, 1, size, fp ); + if ( fread( binary, 1, size, fp ) != size ) + goto fail; const uint8_t *ptr = (const uint8_t*)binary; #define CHECK_STRING( STR )\