summaryrefslogtreecommitdiff
path: root/src/feh_png.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@chaosdorf.de>2016-05-01 18:59:41 +0200
committerDaniel Friesel <derf@chaosdorf.de>2016-05-01 18:59:41 +0200
commit833ed262dba9dcfcc056244937b0f4c9036b4477 (patch)
treef41b718035afdc996bafe344e9677da19086d548 /src/feh_png.c
parent3cc26689e47d37e95f8adc954f80d3754f94b1b7 (diff)
parentffc9d7b1089cf490a11abca484bed56b2f64e775 (diff)
Merge pull request #232 from neosilky/memleak
src/feh_png.c: close file upon error
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;
}