Fixed a tiny memory leak.

Also fixed a Clang static analyzer error for SystemData.
This commit is contained in:
Leon Styhre 2020-10-17 14:32:08 +02:00
parent 930bdce576
commit 0beb40d9c9
4 changed files with 16 additions and 16 deletions

View file

@ -513,7 +513,7 @@ SystemData* SystemData::getRandomSystem(const SystemData* currentSystem)
if (total < 2)
return nullptr;
SystemData* randomSystem;
SystemData* randomSystem = nullptr;
do {
// Get a random number in range.

View file

@ -511,18 +511,18 @@ int main(int argc, char* argv[])
window.pushGui(new GuiMsgBox(&window, helpStyle,
errorMsg.c_str(),
"QUIT", [] {
SDL_Event* quit = new SDL_Event();
quit->type = SDL_QUIT;
SDL_PushEvent(quit);
SDL_Event quit;
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
}, "", nullptr, "", nullptr, true));
}
else if (returnCodeValue == NO_ROMS) {
auto updateVal = [](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory", newROMDirectory);
Settings::getInstance()->saveFile();
SDL_Event* quit = new SDL_Event();
quit->type = SDL_QUIT;
SDL_PushEvent(quit);
SDL_Event quit;
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
};
window.pushGui(new GuiMsgBox(&window, helpStyle, errorMsg.c_str(),
@ -553,9 +553,9 @@ int main(int argc, char* argv[])
true));
},
"QUIT", [] {
SDL_Event* quit = new SDL_Event();
quit->type = SDL_QUIT;
SDL_PushEvent(quit);
SDL_Event quit;
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
}, "", nullptr, true));
}
}

View file

@ -289,9 +289,9 @@ bool InputManager::parseEvent(const SDL_Event& ev, Window* window)
return false;
if (ev.key.keysym.sym == SDLK_F4) {
SDL_Event* quit = new SDL_Event();
quit->type = SDL_QUIT;
SDL_PushEvent(quit);
SDL_Event quit;
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return false;
}

View file

@ -224,9 +224,9 @@ int quitES(QuitMode mode)
{
quitMode = mode;
SDL_Event *quit = new SDL_Event();
quit->type = SDL_QUIT;
SDL_PushEvent(quit);
SDL_Event quit;
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return 0;
}