summaryrefslogtreecommitdiff
path: root/src/feh_png.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/feh_png.c')
-rw-r--r--src/feh_png.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/feh_png.c b/src/feh_png.c
index f02aecb..129eb45 100644
--- a/src/feh_png.c
+++ b/src/feh_png.c
@@ -115,12 +115,15 @@ int feh_png_write_png(Imlib_Image image, char *file, ...)
return 0;
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (!png_ptr)
+ if (!png_ptr) {
+ fclose(fp);
return 0;
+ }
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ fclose(fp);
return 0;
}