aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2022-03-27 09:34:44 +0000
committerGitHub <noreply@github.com>2022-03-27 09:34:44 +0000
commitbf6c0627792485bcdefe5aa055bece21ca22bbec (patch)
treea8c54a7074d1c67b5970e25542f5f181a5f776be
parent590d9fe0a9573ca72fdbab5119fd2c60dce3dd19 (diff)
fix: thumbnail memory leak when removing file (#247)
-rw-r--r--main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.c b/main.c
index 33f5cde..e3ee016 100644
--- a/main.c
+++ b/main.c
@@ -165,6 +165,10 @@ void remove_file(int n, bool manual)
if (n + 1 < filecnt) {
if (tns.thumbs != NULL) {
+ if (tns.thumbs[n].im != NULL) {
+ imlib_context_set_image(tns.thumbs[n].im);
+ imlib_free_image_and_decache();
+ }
memmove(tns.thumbs + n, tns.thumbs + n + 1, (filecnt - n - 1) *
sizeof(*tns.thumbs));
memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs));