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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user