From ed5169c5ebc03518078066b088bc820513328ee7 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Tue, 15 Jul 2014 15:20:05 -0400 Subject: [PATCH] Fix leaking exi devices. --- Source/Core/Core/HW/EXI_DeviceEthernet.cpp | 6 +++--- Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp | 2 +- Source/Core/Core/HW/GCMemcardRaw.cpp | 6 ++++++ Source/Core/Core/HW/GCMemcardRaw.h | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/HW/EXI_DeviceEthernet.cpp index 3cb9bc4cf4..aad43d96e5 100644 --- a/Source/Core/Core/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/HW/EXI_DeviceEthernet.cpp @@ -53,9 +53,9 @@ CEXIETHERNET::~CEXIETHERNET() { Deactivate(); - delete tx_fifo; - delete mBbaMem; - delete mRecvBuffer; + delete[] tx_fifo; + delete[] mBbaMem; + delete[] mRecvBuffer; } void CEXIETHERNET::SetCS(int cs) diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index bdd31551ab..67bac52a59 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -182,7 +182,7 @@ CEXIMemoryCard::~CEXIMemoryCard() { CoreTiming::RemoveEvent(et_this_card); memorycard->Flush(true); - memorycard.release(); + memorycard.reset(); } bool CEXIMemoryCard::IsPresent() diff --git a/Source/Core/Core/HW/GCMemcardRaw.cpp b/Source/Core/Core/HW/GCMemcardRaw.cpp index 5e99607ab8..9b1b180ec3 100644 --- a/Source/Core/Core/HW/GCMemcardRaw.cpp +++ b/Source/Core/Core/HW/GCMemcardRaw.cpp @@ -69,6 +69,12 @@ MemoryCard::MemoryCard(std::string filename, int _card_index, u16 sizeMb) } } +MemoryCard::~MemoryCard() +{ + Flush(true); + delete[] memory_card_content; +} + void MemoryCard::joinThread() { if (flushThread.joinable()) diff --git a/Source/Core/Core/HW/GCMemcardRaw.h b/Source/Core/Core/HW/GCMemcardRaw.h index 80cee42c74..8b75949946 100644 --- a/Source/Core/Core/HW/GCMemcardRaw.h +++ b/Source/Core/Core/HW/GCMemcardRaw.h @@ -21,7 +21,7 @@ class MemoryCard : public MemoryCardBase { public: MemoryCard(std::string filename, int _card_index, u16 sizeMb = MemCard2043Mb); - ~MemoryCard() { Flush(true); } + ~MemoryCard(); void Flush(bool exiting = false) override; s32 Read(u32 address, s32 length, u8 *destaddress) override;