Merge pull request #4895 from janisozaur/fixes

memory leak plugs, initialisation of fields
This commit is contained in:
Ted John 2016-12-20 10:43:05 +00:00 committed by GitHub
commit f378688828
5 changed files with 11 additions and 6 deletions

View File

@ -40,7 +40,9 @@ namespace String
va_start(args, format);
const utf8 * buffer = Format_VA(format, args);
va_end(args);
return ToStd(buffer);
std::string returnValue = ToStd(buffer);
Memory::Free(buffer);
return returnValue;
}
bool IsNullOrEmpty(const utf8 * str)

View File

@ -94,11 +94,11 @@ static void ReportMissingObject(const rct_object_entry * entry);
class ObjectRepository : public IObjectRepository
{
IPlatformEnvironment * _env;
IPlatformEnvironment * _env = nullptr;
std::vector<ObjectRepositoryItem> _items;
QueryDirectoryResult _queryDirectoryResult;
QueryDirectoryResult _queryDirectoryResult = { 0 };
ObjectEntryMap _itemMap;
uint16 _languageId;
uint16 _languageId = 0;
public:
ObjectRepository(IPlatformEnvironment * env)

View File

@ -68,7 +68,7 @@ private:
IPlatformEnvironment * _env;
std::vector<TrackRepositoryItem> _items;
QueryDirectoryResult _directoryQueryResult;
QueryDirectoryResult _directoryQueryResult = { 0 };
public:
TrackDesignRepository(IPlatformEnvironment * env)

View File

@ -122,6 +122,7 @@ extern "C"
Memory::Free(seq->Saves[i]);
}
Memory::Free(seq->Saves);
Memory::Free(seq);
}
}

View File

@ -240,7 +240,9 @@ namespace TitleSequenceManager
if (String::Equals(Path::GetExtension(scanPath), ".txt", true))
{
// If we are given a .txt file, set the path to the containing directory
path = std::string(Path::GetDirectory(scanPath));
utf8 * utf8Path = Path::GetDirectory(scanPath);
path = std::string(utf8Path);
Memory::Free(utf8Path);
isZip = false;
}
else