Attempt at fixing memory issue on Windows build.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
09c71487be
commit
229850257b
|
@ -217,7 +217,7 @@ uint8_t* AngelScripResolver::WriteByteCodeToMemory(size_t& size, bool stripDebug
|
||||||
Assert(result == asSUCCESS);
|
Assert(result == asSUCCESS);
|
||||||
auto arr = stream->GetOut();
|
auto arr = stream->GetOut();
|
||||||
size = stream->GetWrittenSize();
|
size = stream->GetWrittenSize();
|
||||||
arr = static_cast<uint8_t*>(realloc(arr, size));
|
arr = static_cast<uint8_t*>(realloc(arr, size * sizeof(uint8_t)));
|
||||||
delete stream;
|
delete stream;
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,11 @@ public:
|
||||||
int Read(void* ptr, asUINT size) final {
|
int Read(void* ptr, asUINT size) final {
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return 0;
|
return 0;
|
||||||
auto start = reinterpret_cast<uint8_t*>(ptr);
|
|
||||||
auto toRead = size;
|
auto toRead = size;
|
||||||
if (_index + toRead > _size) {
|
if (_index + toRead >= _size) {
|
||||||
toRead = _size - _index;
|
toRead = _size - _index;
|
||||||
}
|
}
|
||||||
|
auto start = reinterpret_cast<uint8_t*>(ptr);
|
||||||
for (asUINT index = 0; index < toRead; index++) {
|
for (asUINT index = 0; index < toRead; index++) {
|
||||||
*(start + index) = _out[_index + index];
|
*(start + index) = _out[_index + index];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue