From 47cef573b7e145a00182639e401148ed0b0d7f10 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 2 Sep 2011 09:34:47 +0200 Subject: Fix memory leak in cb_reload_timer (--reload for directories) (closes #62) Patch by livibetter --- src/slideshow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') 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 */ -- cgit v1.2.3