diff options
author | Daniel Lockyer <thisisdaniellockyer@gmail.com> | 2016-05-01 17:47:17 +0100 |
---|---|---|
committer | Daniel Lockyer <thisisdaniellockyer@gmail.com> | 2016-05-01 17:52:20 +0100 |
commit | ffc9d7b1089cf490a11abca484bed56b2f64e775 (patch) | |
tree | f41b718035afdc996bafe344e9677da19086d548 /src | |
parent | 3cc26689e47d37e95f8adc954f80d3754f94b1b7 (diff) |
src/feh_png.c: close file upon error
Diffstat (limited to 'src')
-rw-r--r-- | src/feh_png.c | 5 |
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; } |