Attempt at fixing memory issue on Windows build.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-04-11 15:03:44 +02:00
parent 09c71487be
commit 229850257b
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 3 additions and 3 deletions

View File

@ -217,7 +217,7 @@ uint8_t* AngelScripResolver::WriteByteCodeToMemory(size_t& size, bool stripDebug
Assert(result == asSUCCESS);
auto arr = stream->GetOut();
size = stream->GetWrittenSize();
arr = static_cast<uint8_t*>(realloc(arr, size));
arr = static_cast<uint8_t*>(realloc(arr, size * sizeof(uint8_t)));
delete stream;
return arr;
}

View File

@ -41,11 +41,11 @@ public:
int Read(void* ptr, asUINT size) final {
if (size == 0)
return 0;
auto start = reinterpret_cast<uint8_t*>(ptr);
auto toRead = size;
if (_index + toRead > _size) {
if (_index + toRead >= _size) {
toRead = _size - _index;
}
auto start = reinterpret_cast<uint8_t*>(ptr);
for (asUINT index = 0; index < toRead; index++) {
*(start + index) = _out[_index + index];
}