]> granicus.if.org Git - libx264/commitdiff
opencl: Check return value of fread()
authorDiego Biurrun <diego@biurrun.de>
Sun, 27 Apr 2014 21:23:49 +0000 (23:23 +0200)
committerFiona Glaser <fiona@x264.com>
Sun, 20 Jul 2014 03:52:57 +0000 (20:52 -0700)
common/opencl.c:138:10: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result]

common/opencl.c

index 9e5e7941a2d50b72980f4b90d2a6b47c8dbb4052..8b223b4c387c9083d830c758f8542aa751b0243b 100644 (file)
@@ -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 )\