1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Fix memory leak

Co-authored-by: Gabriel Guedes <gabriel.guedesaz@gmail.com>
This commit is contained in:
Matt
2020-09-28 17:26:53 +03:00
parent f765ed2f94
commit 850b10f1fd
2 changed files with 4 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ std::unique_ptr<TitleSequence> LoadTitleSequence(const utf8* path)
auto seq = CreateTitleSequence();
seq->Name = Path::GetFileNameWithoutExtension(std::string(path));
seq->Path = String::Duplicate(path);
seq->Path = path;
for (auto* save : saves)
{
seq->Saves.push_back(save);

View File

@@ -137,10 +137,9 @@ namespace TitleSequenceManager
size_t CreateItem(const utf8* name)
{
std::string path = GetNewTitleSequencePath(std::string(name), true);
auto seq = CreateTitleSequence();
seq->Name = name;
seq->Path = String::Duplicate(path.c_str());
seq->Path = GetNewTitleSequencePath(std::string(name), true);
seq->IsZip = true;
bool success = TitleSequenceSave(*seq);
@@ -148,9 +147,9 @@ namespace TitleSequenceManager
size_t index = SIZE_MAX;
if (success)
{
AddSequence(path.c_str());
AddSequence(seq->Path.c_str());
SortSequences();
index = FindItemIndexByPath(path.c_str());
index = FindItemIndexByPath(seq->Path.c_str());
}
return index;
}