audioplayer.cpp fix scandir memleak

This commit is contained in:
Jacek Jendrzej
2020-01-04 12:49:57 +01:00
parent e7d900b9c9
commit 2d5a1c9e29

View File

@@ -2918,10 +2918,11 @@ void CAudioPlayerGui::cleanupCovers()
while (n--) while (n--)
{ {
const char *coverfile = coverlist[n]->d_name; const char *coverfile = coverlist[n]->d_name;
if (strcmp(coverfile, ".") == 0 || strcmp(coverfile, "..") == 0) if (strcmp(coverfile, ".") != 0 && strcmp(coverfile, "..") != 0)
continue; {
printf("[audioplayer] removing cover %s/%s\n", COVERDIR_TMP, coverfile); printf("[audioplayer] removing cover %s/%s\n", COVERDIR_TMP, coverfile);
unlink(((std::string)COVERDIR_TMP + "/" + coverfile).c_str()); unlink(((std::string)COVERDIR_TMP + "/" + coverfile).c_str());
}
free(coverlist[n]); free(coverlist[n]);
} }
free(coverlist); free(coverlist);