Must memset the new allocation or we can use an unitialized value from the buffer

This commit is contained in:
Isaac Connor
2022-06-08 16:45:13 -04:00
parent 1531ced590
commit 1b107b2e02

View File

@@ -54,6 +54,8 @@ unsigned int Buffer::expand(unsigned int count) {
if ( mStorage ) {
memcpy(newStorage, mHead, mSize);
delete[] mStorage;
} else {
memset(newStorage, 0, mAllocation);
}
mStorage = newStorage;
mHead = mStorage;