[x264-devel] [PATCH] opencl: Check return value of fread()

Diego Biurrun diego at biurrun.de
Sun Apr 27 23:24:21 CEST 2014


common/opencl.c:138:10: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
---
 common/opencl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/opencl.c b/common/opencl.c
index 9e5e794..8b223b4 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 )\
-- 
1.8.3.2



More information about the x264-devel mailing list