From d473ac13e7b70e8ad7a009a0f8c6d793934d03f1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 5 Dec 2020 21:28:11 +0100 Subject: free accompanying EXIF data when freeing an image This fixes two memory bugs that only manifest with exif=1 and long-running slideshows. * when feh loads an image, it writes exif data to file->ed. Previously, this data was never free'd, causing a memory leak on subsequent loads of the same file. * As file->ed is never free'd, the accumulated EXIF data consumes a significant amount of memory over time. with slideshow-delay = 10 and two days of runtime, feh may exceed 1 GB of memory usage. If the slideshow is so large that feh does not encounter the same image twice in this time, this is not detected as a memory leak, as each EXIF data chunk is referenced from the filelist. See for details. Closes #553 --- src/winwidget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/winwidget.c') diff --git a/src/winwidget.c b/src/winwidget.c index bfd987d..119c3af 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -1014,8 +1014,9 @@ void winwidget_rename(winwidget winwid, char *newname) void winwidget_free_image(winwidget w) { - if (w->im) + if (w->im) { gib_imlib_free_image(w->im); + } w->im = NULL; w->im_w = 0; w->im_h = 0; -- cgit v1.2.3