img_load_webp: close the file handler and use errno
This commit is contained in:
parent
22ca3b567d
commit
b0b16f1d0f
7
image.c
7
image.c
|
@ -314,9 +314,9 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
unsigned int delay;
|
unsigned int delay;
|
||||||
bool err = false;
|
bool err = false;
|
||||||
|
|
||||||
if ((err = (webp_file = fopen(file->path, "rb")) == NULL)) {
|
if ((webp_file = fopen(file->path, "rb")) == NULL) {
|
||||||
error(0, 0, "%s: Error opening webp image", file->name);
|
error(0, errno, "%s: Error opening webp image", file->name);
|
||||||
goto fail;
|
return false;
|
||||||
}
|
}
|
||||||
fseek(webp_file, 0L, SEEK_END);
|
fseek(webp_file, 0L, SEEK_END);
|
||||||
data.size = ftell(webp_file);
|
data.size = ftell(webp_file);
|
||||||
|
@ -387,6 +387,7 @@ fail:
|
||||||
if (dec != NULL)
|
if (dec != NULL)
|
||||||
WebPAnimDecoderDelete(dec);
|
WebPAnimDecoderDelete(dec);
|
||||||
free(bytes);
|
free(bytes);
|
||||||
|
fclose(webp_file);
|
||||||
return !err;
|
return !err;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBWEBP */
|
#endif /* HAVE_LIBWEBP */
|
||||||
|
|
Loading…
Reference in New Issue