From b1a2fcfddd2b056d2a436c413245d01dd8c63466 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Fri, 25 Jan 2019 23:12:01 +0100 Subject: [PATCH] Fix Memory leak when switching back and forth from 64DD to N64 --- Source/Project64-core/N64System/N64Class.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index 3609860bc..455761203 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -339,11 +339,6 @@ bool CN64System::LoadFileImage(const char * FileLoc) g_Settings->SaveString(File_DiskIPLPath, FileLoc); } - if (g_DDRom != NULL) - { - g_Settings->SaveBool(Setting_EnableDisk, true); - } - g_System->RefreshGameSettings(); if (g_Rom->CicChipID() != CIC_NUS_8303 && g_Rom->CicChipID() != CIC_NUS_DDUS) @@ -373,11 +368,13 @@ bool CN64System::RunFileImage(const char * FileLoc) //Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously. if (g_Disk != NULL) { + g_Disk->UnallocateDiskImage(); delete g_Disk; g_Disk = NULL; } if (g_DDRom != NULL) { + g_DDRom->UnallocateRomImage(); delete g_DDRom; g_DDRom = NULL; }