[cocos2dx] Segfault when copying old scratch buffer contents to resized buffer. Closes #1295.

This commit is contained in:
badlogic 2019-03-07 19:00:47 +01:00
parent 088fb2ea02
commit 5c62f78ed4

View File

@ -44,7 +44,7 @@ static size_t worldVerticesLength = 0;
void ensureWorldVerticesCapacity(size_t capacity) {
if (worldVerticesLength < capacity) {
float* newWorldVertices = new float[capacity];
memcpy(newWorldVertices, worldVertices, capacity * sizeof(float));
memcpy(newWorldVertices, worldVertices, worldVerticesLength * sizeof(float));
delete[] worldVertices;
worldVertices = newWorldVertices;
worldVerticesLength = capacity;