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

This commit is contained in:
badlogic 2019-03-07 19:00:17 +01:00
parent 997cb49a28
commit 2eb85acff9

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;