From 2d5a1c9e293548c1c4ec22df8fc429070025ba80 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 4 Jan 2020 12:49:57 +0100 Subject: [PATCH] audioplayer.cpp fix scandir memleak --- src/gui/audioplayer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 78ea4fbe5..1de9db27e 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -2918,10 +2918,11 @@ void CAudioPlayerGui::cleanupCovers() while (n--) { const char *coverfile = coverlist[n]->d_name; - if (strcmp(coverfile, ".") == 0 || strcmp(coverfile, "..") == 0) - continue; - printf("[audioplayer] removing cover %s/%s\n", COVERDIR_TMP, coverfile); - unlink(((std::string)COVERDIR_TMP + "/" + coverfile).c_str()); + if (strcmp(coverfile, ".") != 0 && strcmp(coverfile, "..") != 0) + { + printf("[audioplayer] removing cover %s/%s\n", COVERDIR_TMP, coverfile); + unlink(((std::string)COVERDIR_TMP + "/" + coverfile).c_str()); + } free(coverlist[n]); } free(coverlist);