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 committed 2018-07-18 00:07:48 +02:00
1 parent 45aad7ce77
commit 34cf068650
1 file changed
+2 -2
+2 -2
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: