summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-12 20:15:10 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-12 20:17:30 +0200
commitaf2a44237a7b5cebbf0d03375ed742809da15a59 (patch)
treed670f47e40e311efaeb8939c8c04a5eee7591300
parent8f10b0cd7ca08b01ac6fc20f3ce7901e01ad3027 (diff)
feh_load_image: Do not add file to rm filelist unless it is cached
This fixes a "memory leak" (though strictly speaking it is none) when using feh --reload on http URLs.
-rw-r--r--ChangeLog6
-rw-r--r--src/imlib.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 86157d0..ca87970 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+git HEAD
+
+ * Fix useless memory use when using feh --reload on HTTP URLs
+ (fun fact: strictly speaking, this was not a memory leak)
+ <https://github.com/derf/feh/issues/62>
+
Sun, 11 Sep 2011 12:46:50 +0200 Daniel Friesel <derf@finalrewind.org>
* Release v1.16.1
diff --git a/src/imlib.c b/src/imlib.c
index 45de85c..28ae018 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -151,13 +151,14 @@ int feh_load_image(Imlib_Image * im, feh_file * file)
/* Http, no reload, slideshow. Let's keep this image on hand... */
free(file->filename);
file->filename = estrdup(tmpname);
+
+ if (!opt.keep_http)
+ add_file_to_rm_filelist(tmpname);
} else {
/* Don't cache the image if we're doing reload + http (webcams etc) */
if (!opt.keep_http)
unlink(tmpname);
}
- if (!opt.keep_http)
- add_file_to_rm_filelist(tmpname);
free(tmpname);
} else {
*im = imlib_load_image_with_error_return(file->filename, &err);