Skip to content
Permalink
Browse files

Merge pull request #8108 from lioncash/use-after-move

Core/Boot/Boot: Amend use-after-move cases in GenerateFromFile()
  • Loading branch information...
leoetlino committed May 21, 2019
2 parents e2c769a + 1d22e50 commit 99ba260b517e005bfb4f40fb3ee45b80d12ff832
Showing with 7 additions and 5 deletions.
  1. +7 −5 Source/Core/Core/Boot/Boot.cpp
@@ -155,7 +155,7 @@ BootParameters::GenerateFromFile(std::vector<std::string> paths,
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
}

const std::string path = paths.front();
std::string path = paths.front();
if (paths.size() == 1)
paths.clear();

@@ -172,14 +172,16 @@ BootParameters::GenerateFromFile(std::vector<std::string> paths,

if (extension == ".elf")
{
return std::make_unique<BootParameters>(
Executable{std::move(path), std::make_unique<ElfReader>(path)}, savestate_path);
auto elf_reader = std::make_unique<ElfReader>(path);
return std::make_unique<BootParameters>(Executable{std::move(path), std::move(elf_reader)},
savestate_path);
}

if (extension == ".dol")
{
return std::make_unique<BootParameters>(
Executable{std::move(path), std::make_unique<DolReader>(path)}, savestate_path);
auto dol_reader = std::make_unique<DolReader>(path);
return std::make_unique<BootParameters>(Executable{std::move(path), std::move(dol_reader)},
savestate_path);
}

if (is_drive)

0 comments on commit 99ba260

Please sign in to comment.
You can’t perform that action at this time.