summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/feh_png.c5
-rw-r--r--src/wallpaper.c9
2 files changed, 12 insertions, 2 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;
}
diff --git a/src/wallpaper.c b/src/wallpaper.c
index b6f2c0c..a11a50d 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -292,7 +292,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
Atom prop_root, prop_esetroot, type;
int format, i;
unsigned long length, after;
- unsigned char *data_root, *data_esetroot;
+ unsigned char *data_root = NULL, *data_esetroot = NULL;
Pixmap pmap_d1, pmap_d2;
gib_list *l;
@@ -550,6 +550,13 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
}
}
}
+
+ if (data_root)
+ XFree(data_root);
+
+ if (data_esetroot)
+ XFree(data_esetroot);
+
/* This will locate the property, creating it if it doesn't exist */
prop_root = XInternAtom(disp2, "_XROOTPMAP_ID", False);
prop_esetroot = XInternAtom(disp2, "ESETROOT_PMAP_ID", False);