aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2021-11-18 04:38:25 +0600
committerN-R-K <79544946+N-R-K@users.noreply.github.com>2021-12-12 17:58:17 +0600
commitb0b16f1d0ffa550a8358206de844c9cf13f94ada (patch)
tree38a44e6e1a6c1055aedffeb3a2924eb008f5ed50
parent22ca3b567dd08c0086399221cb1413fa4eb74e2e (diff)
img_load_webp: close the file handler and use errno
-rw-r--r--image.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/image.c b/image.c
index 0dd39c7..7bc5239 100644
--- a/image.c
+++ b/image.c
@@ -314,9 +314,9 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
unsigned int delay;
bool err = false;
- if ((err = (webp_file = fopen(file->path, "rb")) == NULL)) {
- error(0, 0, "%s: Error opening webp image", file->name);
- goto fail;
+ if ((webp_file = fopen(file->path, "rb")) == NULL) {
+ error(0, errno, "%s: Error opening webp image", file->name);
+ return false;
}
fseek(webp_file, 0L, SEEK_END);
data.size = ftell(webp_file);
@@ -387,6 +387,7 @@ fail:
if (dec != NULL)
WebPAnimDecoderDelete(dec);
free(bytes);
+ fclose(webp_file);
return !err;
}
#endif /* HAVE_LIBWEBP */