user_menue: fix use heap after free, 2. try

Origin commit data
------------------
Branch: ni/coolstream
Commit: c52b1d3c16
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-12-31 (Tue, 31 Dec 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-12-31 00:26:58 +01:00
committed by vanhofen
parent cb19ca717a
commit b48c8f103e
2 changed files with 14 additions and 9 deletions

View File

@@ -97,7 +97,7 @@ extern cVideo * videoDecoder;
#if !HAVE_SPARK_HARDWARE
extern CCAMMenuHandler * g_CamHandler;
#endif
std::string CUserMenu::tmp;
//
#include <system/debug.h>
@@ -625,7 +625,6 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
neutrino_locale_t loc = NONEXISTANT_LOCALE;
const char *text = NULL;
int mode = CNeutrinoApp::getInstance()->getMode();
std::vector<std::string> items = ::split(g_settings.usermenu[button]->items, ',');
for (std::vector<std::string>::iterator it = items.begin(); it != items.end(); ++it) {
int item = -1;
@@ -640,7 +639,8 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
int nop = g_Plugins->getNumberOfPlugins();
for(int count = 0; count < nop; count++) {
if (std::string(g_Plugins->getFileName(count)) == *it) {
text = g_Plugins->getName(count);
tmp = g_Plugins->getName(count);
text = tmp.c_str();
active = true;
break;
}
@@ -653,7 +653,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
if (mode == NeutrinoModes::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) {
if(loc == NONEXISTANT_LOCALE && !text) {
CWebTVResolution webtvres;
std::string tmp = webtvres.getResolutionValue();
tmp = webtvres.getResolutionValue();
if (!(videoDecoder->getBlank()))
{
int xres = 0, yres = 0, framerate;
@@ -700,11 +700,15 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
continue;
case SNeutrinoSettings::ITEM_AUDIO_SELECT:
if(loc == NONEXISTANT_LOCALE && !text) {
if (mode == NeutrinoModes::mode_webtv)
text = CMoviePlayerGui::getInstance(true).CurrentAudioName().c_str(); // use instance_bg
else if (!g_RemoteControl->current_PIDs.APIDs.empty())
text = g_RemoteControl->current_PIDs.APIDs[
if (mode == NeutrinoModes::mode_webtv){
tmp = CMoviePlayerGui::getInstance(true).CurrentAudioName(); // use instance_bg.
text = tmp.c_str();
}
else if (!g_RemoteControl->current_PIDs.APIDs.empty()){
tmp = g_RemoteControl->current_PIDs.APIDs[
g_RemoteControl->current_PIDs.PIDs.selected_apid].desc;
text = tmp.c_str();
}
} else
return_title = true;
active = true;