From ad1634631f3e7a7e0db728662c7b78de373eeecc Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 8 Feb 2017 21:53:37 +0000 Subject: [PATCH] Fix MemoryStream::EnsureCapacity --- src/openrct2/core/MemoryStream.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openrct2/core/MemoryStream.cpp b/src/openrct2/core/MemoryStream.cpp index d6dcfe75fe..9a7f66cd31 100644 --- a/src/openrct2/core/MemoryStream.cpp +++ b/src/openrct2/core/MemoryStream.cpp @@ -178,7 +178,9 @@ void MemoryStream::EnsureCapacity(size_t capacity) newCapacity *= 2; } + uint64 position = GetPosition(); _dataCapacity = newCapacity; - Memory::Reallocate(_data, _dataCapacity); + _data = Memory::Reallocate(_data, _dataCapacity); + _position = (void *)((uintptr_t)_data + (uintptr_t)position); } }