From c277c5152d54b49720327ebbc0c9563c8bcf5a6d Mon Sep 17 00:00:00 2001 From: tomcw Date: Sat, 26 Feb 2022 20:23:00 +0000 Subject: [PATCH] Fix a few medium Coverity defects: 1514566, 1063811 --- source/Memory.cpp | 10 +++++----- source/Windows/AppleWin.cpp | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/Memory.cpp b/source/Memory.cpp index 8ff10d3e..0d9b4e80 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1757,8 +1757,8 @@ void MemInitializeFromSnapshot(void) if (IsApple2PlusOrClone(GetApple2Type()) && (GetCardMgr().QuerySlot(SLOT3) == CT_VidHD)) { - VidHDCard* vidHD = dynamic_cast(GetCardMgr().GetObj(SLOT3)); - memVidHD = vidHD->IsWriteAux() ? memaux : NULL; + VidHDCard& vidHD = dynamic_cast(GetCardMgr().GetRef(SLOT3)); + memVidHD = vidHD.IsWriteAux() ? memaux : NULL; } } @@ -2026,9 +2026,9 @@ BYTE __stdcall MemSetPaging(WORD programcounter, WORD address, BYTE write, BYTE { if (GetCardMgr().QuerySlot(SLOT3) == CT_VidHD) { - VidHDCard* vidHD = dynamic_cast(GetCardMgr().GetObj(SLOT3)); - vidHD->VideoIOWrite(programcounter, address, write, value, nExecutedCycles); - memVidHD = vidHD->IsWriteAux() ? memaux : NULL; + VidHDCard& vidHD = dynamic_cast(GetCardMgr().GetRef(SLOT3)); + vidHD.VideoIOWrite(programcounter, address, write, value, nExecutedCycles); + memVidHD = vidHD.IsWriteAux() ? memaux : NULL; } } diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index 0acae02d..ee5aabda 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -565,13 +565,14 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) } } while (g_bRestart); + + Shutdown(); } - catch(const std::exception & exception) + catch (const std::exception& exception) { ExceptionHandler(exception.what()); } - Shutdown(); return 0; }