1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Fix memory leak when deserialising objects

Assigning a pointer to std::string appears to only perform a copy and
does not transfer ownership of the pointer, thus the allocated memory is
will never be freed. Use IStream::ReadStdString instead to return a
std::string directly, thus transferring ownership correctly.
This commit is contained in:
Øystein Dale
2018-07-17 23:27:16 +02:00
parent 45aad7ce77
commit 34cf068650

View File

@@ -156,8 +156,8 @@ protected:
ObjectRepositoryItem item;
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
item.Path = stream->ReadString();
item.Name = stream->ReadString();
item.Path = stream->ReadStdString();
item.Name = stream->ReadStdString();
switch (object_entry_get_type(&item.ObjectEntry)) {
case OBJECT_TYPE_RIDE: