gui/osdlang_setup.cpp: fix memleak - with dynamic menus locale = strdup never freed

Origin commit data
------------------
Commit: 5cb86b5857
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-05-07 (Mon, 07 May 2012)
This commit is contained in:
[CST] Focus
2012-05-07 14:57:01 +04:00
parent b58db6fb11
commit 6ea2875349

View File

@@ -171,18 +171,14 @@ void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup)
{
for (int count=0; count<n; count++)
{
char * locale = strdup(namelist[count]->d_name);
char * locale = namelist[count]->d_name;
char * pos = strstr(locale, ".locale");
if (pos != NULL)
{
char iname[50];
*pos = '\0';
sprintf(iname, "%s", locale);
CMenuOptionLanguageChooser* oj = new CMenuOptionLanguageChooser((char*)locale, this, iname);
oj->addOption(locale);
CMenuOptionLanguageChooser* oj = new CMenuOptionLanguageChooser((char*)locale, this, locale);
osdl_setup->addItem( oj );
} else
free(locale);
}
free(namelist[count]);
}
free(namelist);