diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index 399d698f25..dd11468580 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -233,6 +233,7 @@ protected: public: XEmitter() { code = NULL; } XEmitter(u8 *code_ptr) { code = code_ptr; } + virtual ~XEmitter() {} void WriteModRM(int mod, int rm, int reg); void WriteSIB(int scale, int index, int base); diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 72fc41bc87..772ca1ab6a 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -262,7 +262,7 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename) /* Called from: Get__() functions in this file only (not from anywhere else), therefore we can leave all condition checks in the Get__() functions below. */ -void *CPluginManager::LoadPlugin(const char *_rFilename, int Number) +void *CPluginManager::LoadPlugin(const char *_rFilename) { // Create a string of the filename std::string Filename = _rFilename; @@ -275,7 +275,7 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number) Dolphin was started */ CPluginInfo *info = NULL; GetPluginInfo(info, Filename); - if (! info) { + if (!info) { PanicAlert("Error loading %s: can't read info", _rFilename); return NULL; } @@ -303,12 +303,14 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number) default: PanicAlert("Trying to load unsupported type %d", type); + return NULL; } // Check that the plugin has both all the common and all the type specific functions if (!plugin->IsValid()) { PanicAlert("Can't open %s, it has a missing function", _rFilename); + delete plugin; return NULL; } @@ -379,8 +381,12 @@ void CPluginManager::ScanForPlugins() Common::PluginPAD *CPluginManager::GetPad(int controller) { if (m_pad[controller] != NULL) + { if (m_pad[controller]->GetFilename() == m_params->m_strPadPlugin[controller]) return m_pad[controller]; + else + FreePad(controller); + } // Else load a new plugin m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str()); @@ -390,8 +396,12 @@ Common::PluginPAD *CPluginManager::GetPad(int controller) Common::PluginWiimote *CPluginManager::GetWiimote(int controller) { if (m_wiimote[controller] != NULL) + { if (m_wiimote[controller]->GetFilename() == m_params->m_strWiimotePlugin[controller]) return m_wiimote[controller]; + else + FreeWiimote(controller); + } // Else load a new plugin m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params->m_strWiimotePlugin[controller].c_str()); @@ -401,8 +411,12 @@ Common::PluginWiimote *CPluginManager::GetWiimote(int controller) Common::PluginDSP *CPluginManager::GetDSP() { if (m_dsp != NULL) + { if (m_dsp->GetFilename() == m_params->m_strDSPPlugin) return m_dsp; + else + FreeDSP(); + } // Else load a new plugin m_dsp = (Common::PluginDSP*)LoadPlugin(m_params->m_strDSPPlugin.c_str()); return m_dsp; diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index de478c6b60..60838c8ff8 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -82,7 +82,7 @@ private: CPluginManager(); ~CPluginManager(); void GetPluginInfo(CPluginInfo *&info, std::string Filename); - void *LoadPlugin(const char *_rFilename, int Number = 0); + void *LoadPlugin(const char *_rFilename); }; diff --git a/Source/Core/DebuggerWX/Src/JitWindow.cpp b/Source/Core/DebuggerWX/Src/JitWindow.cpp index 190a410aa4..dee445084a 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.cpp +++ b/Source/Core/DebuggerWX/Src/JitWindow.cpp @@ -143,6 +143,7 @@ void CJitWindow::Compare(u32 em_address) if (block_num < 0) { ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)", em_address).c_str())); x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str())); + delete[] xDis; return; } } @@ -210,7 +211,7 @@ void CJitWindow::Compare(u32 em_address) } - delete [] xDis; + delete[] xDis; } void CJitWindow::Update() diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index 6b358863d9..8103dd9d15 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -98,7 +98,8 @@ GameListItem::GameListItem(const std::string& _rFileName) if (pBannerLoader->GetBanner(g_ImageTemp)) { m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3; - m_pImage = new u8[m_ImageSize]; //(u8*)malloc(m_ImageSize); + //use malloc(), since wxImage::Create below calls free() afterwards. + m_pImage = (u8*)malloc(m_ImageSize); for (size_t i = 0; i < DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT; i++) { @@ -125,12 +126,9 @@ GameListItem::GameListItem(const std::string& _rFileName) } } - // i am not sure if this is a leak or if wxImage will release the code if (m_pImage) { -#if defined(HAVE_WX) && HAVE_WX m_Image.Create(DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT, m_pImage); -#endif } else { diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 3dcf8a53b7..c4cef4f635 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -214,9 +214,10 @@ CISOProperties::~CISOProperties() } else if (!IsVolumeWadFile(OpenISO)) - if(pFileSystem) + if (pFileSystem) delete pFileSystem; + delete OpenGameListItem; delete OpenISO; }