diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp index 87de9b6a53..a538bcd1b7 100644 --- a/Source/Core/Core/CoreParameter.cpp +++ b/Source/Core/Core/CoreParameter.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include "Common/CDUtils.h" #include "Common/CommonPaths.h" @@ -133,7 +134,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) bootDrive) { m_BootType = BOOT_ISO; - DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); + std::unique_ptr pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); if (pVolume == nullptr) { if (bootDrive) @@ -151,7 +152,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) m_strRevisionSpecificUniqueID = pVolume->GetRevisionSpecificUniqueID(); // Check if we have a Wii disc - bWii = DiscIO::IsVolumeWiiDisc(pVolume); + bWii = DiscIO::IsVolumeWiiDisc(pVolume.get()); switch (pVolume->GetCountry()) { case DiscIO::IVolume::COUNTRY_USA: @@ -182,10 +183,12 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) bNTSC = false; Region = EUR_DIR; break; - }else return false; + } + else + { + return false; + } } - - delete pVolume; } else if (!strcasecmp(Extension.c_str(), ".elf")) { @@ -209,17 +212,16 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) bNTSC = true; m_BootType = BOOT_DFF; - FifoDataFile *ddfFile = FifoDataFile::Load(m_strFilename, true); + std::unique_ptr ddfFile(FifoDataFile::Load(m_strFilename, true)); if (ddfFile) { bWii = ddfFile->GetIsWii(); - delete ddfFile; } } else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid()) { - const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename); + std::unique_ptr pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename)); const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr) @@ -267,7 +269,6 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { m_strName = pVolume->GetName(); m_strUniqueID = pVolume->GetUniqueID(); - delete pVolume; } else { @@ -290,7 +291,6 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { m_strUniqueID = titleidstr; } - } else {