From 106c34f5dc61e6a7605d7c54eaaead874d05bd10 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 3 Jan 2020 16:52:29 +0100 Subject: [PATCH] screensaver.cpp and webtv_setup fix scandir memleak --- src/gui/screensaver.cpp | 8 +++++++- src/gui/webtv_setup.cpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 237b3936f..be3ddf7d7 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -197,8 +197,14 @@ bool CScreenSaver::ReadDir() { struct dirent **coverlist; int n = scandir(COVERDIR_TMP, &coverlist, 0, alphasort); - if (n > 2) // we always have the "." and ".." entrys + if (n > 2){ // we always have the "." and ".." entrys show_audiocover = true; + for (int i = 0; i < n; i++) + { + free(coverlist[i]); + } + free(coverlist); + } } } diff --git a/src/gui/webtv_setup.cpp b/src/gui/webtv_setup.cpp index 38cf66dde..3d9648511 100644 --- a/src/gui/webtv_setup.cpp +++ b/src/gui/webtv_setup.cpp @@ -375,7 +375,9 @@ void CWebTVSetup::webchannels_auto() { printf("[CWebTVSetup] skipping: %s\n", webchannel_file); } + free(filelist[count]); } + free(filelist); } } }