Bug 1462049: Fix MemStream allocation to only allocate its capacity. r=jrmuizel

This commit is contained in:
Bob Owen 2018-05-16 18:26:24 +01:00
parent 344259ad39
commit 8a6b8bfbbf

View File

@ -193,11 +193,11 @@ struct MemStream {
if (mLength > mCapacity) {
mCapacity = mCapacity * 2;
// check if the doubled capacity is enough
// otherwise use mLength
// otherwise use double mLength
if (mLength > mCapacity) {
mCapacity = mLength;
mCapacity = mLength * 2;
}
mData = (char*)realloc(mData, mCapacity * 2);
mData = (char*)realloc(mData, mCapacity);
}
}