summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-01-03 21:00:50 +0100
committerbunnei <bunneidev@gmail.com>2015-01-03 21:00:50 +0100
commita0cb320bad1e19e6a709183c2e5c7c44a43f27a1 (patch)
tree3dd1a96521740d1e75a1ce4578abed271b7853b1 /src/core
parentMerge pull request #396 from bunnei/default-dyncom (diff)
parentFileSys: Fix a few memory leaks (diff)
downloadyuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar.gz
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar.bz2
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar.lz
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar.xz
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.tar.zst
yuzu-a0cb320bad1e19e6a709183c2e5c7c44a43f27a1.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/disk_archive.cpp11
-rw-r--r--src/core/file_sys/disk_archive.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 0197f727d..c6e033fcd 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -6,6 +6,7 @@
#include "common/common_types.h"
#include "common/file_util.h"
+#include "common/make_unique.h"
#include "core/file_sys/disk_archive.h"
#include "core/settings.h"
@@ -17,10 +18,10 @@ namespace FileSys {
std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode mode) const {
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
- DiskFile* file = new DiskFile(this, path, mode);
+ auto file = Common::make_unique<DiskFile>(this, path, mode);
if (!file->Open())
return nullptr;
- return std::unique_ptr<FileBackend>(file);
+ return std::move(file);
}
bool DiskArchive::DeleteFile(const Path& path) const {
@@ -66,10 +67,10 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const {
LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str());
- DiskDirectory* directory = new DiskDirectory(this, path);
+ auto directory = Common::make_unique<DiskDirectory>(this, path);
if (!directory->Open())
return nullptr;
- return std::unique_ptr<DirectoryBackend>(directory);
+ return std::move(directory);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -100,7 +101,7 @@ bool DiskFile::Open() {
// Open the file in binary mode, to avoid problems with CR/LF on Windows systems
mode_string += "b";
- file = new FileUtil::IOFile(path, mode_string.c_str());
+ file = Common::make_unique<FileUtil::IOFile>(path, mode_string.c_str());
return true;
}
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index f18d96f5a..4663a9591 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -75,7 +75,7 @@ protected:
const DiskArchive* archive;
std::string path;
Mode mode;
- FileUtil::IOFile* file;
+ std::unique_ptr<FileUtil::IOFile> file;
};
class DiskDirectory : public DirectoryBackend {