diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-09-02 09:34:47 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-09-02 09:34:47 +0200 |
commit | 47cef573b7e145a00182639e401148ed0b0d7f10 (patch) | |
tree | 796ff57daf10b60b6c6bdd636836d191a6b4091b | |
parent | ed5f55e967152ff6c7308858cb019bea2015d314 (diff) |
Fix memory leak in cb_reload_timer (--reload for directories) (closes #62)
Patch by livibetter
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/slideshow.c | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -11,6 +11,8 @@ git HEAD <https://github.com/derf/feh/issues/5> * Fix segfault when reloading no longer loadable (but still existing) images. feh will now display a warning and try to reload ad infinitum + * Fix memory leak in reload functionality for directories + <https://github.com/derf/feh/issues/62> Tue, 16 Aug 2011 22:48:06 +0200 Daniel Friesel <derf@finalrewind.org> diff --git a/src/slideshow.c b/src/slideshow.c index 511d29c..e47b896 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -96,6 +96,11 @@ void cb_reload_timer(void *data) /* save the current filename for refinding it in new list */ current_filename = estrdup(FEH_FILE(current_file->data)->filename); + + for (l = filelist; l; l = l->next) { + feh_file_free(l->data); + l->data = NULL; + } gib_list_free_and_data(filelist); filelist = NULL; filelist_len = 0; @@ -109,8 +114,7 @@ void cb_reload_timer(void *data) add_file_to_filelist_recursively(".", FILELIST_FIRST); if (!(filelist_len = gib_list_length(filelist))) { - fprintf(stderr, "No files found to reload.\n"); - exit(1); + eprintf("No files found to reload."); } /* find the previously current file */ |