diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 063186016..02b4d5949 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -108,6 +108,9 @@ void CPlugins::scanDir(const char *dir) int number_of_files = scandir(dir, &namelist, 0, alphasort); + if(number_of_files < 0) + return; + for (int i = 0; i < number_of_files; i++) { std::string filename; @@ -147,7 +150,9 @@ void CPlugins::scanDir(const char *dir) } } } + free(namelist[i]); } + free(namelist); } void CPlugins::loadPlugins()