gui/plugins.cpp: fix memleak in scandir

This commit is contained in:
[CST] Focus
2012-05-04 12:23:44 +04:00
parent a2caf42de4
commit 37d5e13d43

View File

@@ -108,6 +108,9 @@ void CPlugins::scanDir(const char *dir)
int number_of_files = scandir(dir, &namelist, 0, alphasort); int number_of_files = scandir(dir, &namelist, 0, alphasort);
if(number_of_files < 0)
return;
for (int i = 0; i < number_of_files; i++) for (int i = 0; i < number_of_files; i++)
{ {
std::string filename; std::string filename;
@@ -147,7 +150,9 @@ void CPlugins::scanDir(const char *dir)
} }
} }
} }
free(namelist[i]);
} }
free(namelist);
} }
void CPlugins::loadPlugins() void CPlugins::loadPlugins()