mirror of https://github.com/intel/libva-utils.git
decode/loadjpeg: Add return value check for fread.
Check the return value to fix build warning. Signed-off-by: Jun Zhao <jun.zhao@intel.com>
This commit is contained in:
parent
aa563e23a6
commit
9cf3c47d92
|
@ -65,6 +65,7 @@ int convert_one_image(const char *infilename)
|
|||
unsigned int width, height;
|
||||
unsigned char *buf;
|
||||
struct jdec_private *jdec;
|
||||
size_t n_items;
|
||||
|
||||
/* Load the Jpeg into memory */
|
||||
fp = fopen(infilename, "rb");
|
||||
|
@ -74,8 +75,12 @@ int convert_one_image(const char *infilename)
|
|||
buf = (unsigned char *)malloc(length_of_file + 4);
|
||||
if (buf == NULL)
|
||||
exitmessage("Not enough memory for loading file\n");
|
||||
fread(buf, length_of_file, 1, fp);
|
||||
n_items = fread(buf, length_of_file, 1, fp);
|
||||
fclose(fp);
|
||||
if (n_items != 1) {
|
||||
free(buf);
|
||||
exitmessage("Reading file fail\n");
|
||||
}
|
||||
|
||||
/* Decompress it */
|
||||
jdec = tinyjpeg_init();
|
||||
|
|
Loading…
Reference in New Issue