From 1f16ed9fd0956e73f8ff59a90204b476a56e8a2a Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 5 Oct 2017 11:56:13 +0300 Subject: [PATCH] UnrealLoader: Fix IOStream leak --- code/UnrealLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/UnrealLoader.cpp b/code/UnrealLoader.cpp index c8382cb..a79a2a5 100644 --- a/code/UnrealLoader.cpp +++ b/code/UnrealLoader.cpp @@ -157,7 +157,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, DefaultLogger::get()->debug("UNREAL: uc file is " + uc_path); // and open the files ... we can't live without them - IOStream* p = pIOHandler->Open(d_path); + std::unique_ptr p(pIOHandler->Open(d_path)); if (!p) throw DeadlyImportError("UNREAL: Unable to open _d file"); StreamReaderLE d_reader(pIOHandler->Open(d_path)); @@ -203,7 +203,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, d_reader.IncPtr(1); } - p = pIOHandler->Open(a_path); + p.reset(pIOHandler->Open(a_path)); if (!p) throw DeadlyImportError("UNREAL: Unable to open _a file"); StreamReaderLE a_reader(pIOHandler->Open(a_path)); -- 2.7.4