diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index cc16ec2fb..2dbb9abd9 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -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. diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 9c6ad4247..dd511a4f8 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -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)); } } diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index a67e83b05..bcbeaf455 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -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; } diff --git a/es-core/src/Platform.cpp b/es-core/src/Platform.cpp index 7deb1ad02..bf018f429 100644 --- a/es-core/src/Platform.cpp +++ b/es-core/src/Platform.cpp @@ -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; }