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

View File

@@ -71,7 +71,8 @@ class CUserMenu : public CChangeObserver
private: private:
int width; int width;
bool changeNotify(const neutrino_locale_t OptionName, void *); bool changeNotify(const neutrino_locale_t OptionName, void *);
static std::string tmp;
public: public:
CUserMenu(); CUserMenu();
~CUserMenu(); ~CUserMenu();