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

Diego Biurrun git at videolan.org
Sun Jul 20 11:58:29 CEST 2014


x264 | branch: master | Diego Biurrun <diego at biurrun.de> | Sun Apr 27 23:23:49 2014 +0200| [c15f20bd772487d863f01a2813a3ab45b1f11a6b] | committer: Fiona Glaser

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]

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c15f20bd772487d863f01a2813a3ab45b1f11a6b
---

 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 )\



More information about the x264-devel mailing list