Bug 1413651 - Correct the chunk range to dealloc shmem when AllocChunk() fails to return. r=nical

This commit is contained in:
vincentliu 2017-11-07 15:49:46 +08:00
parent da2b4b335a
commit a900bb5807

View File

@ -48,7 +48,7 @@ ShmSegmentsWriter::Write(Range<uint8_t> aBytes)
while (remainingBytesToCopy > 0) {
if (dstCursor >= mSmallAllocs.Length() * mChunkSize) {
if (!AllocChunk()) {
for (size_t i = mSmallAllocs.Length() ; currAllocLen <= i ; i--) {
for (size_t i = mSmallAllocs.Length() ; currAllocLen < i ; i--) {
ipc::Shmem shm = mSmallAllocs.ElementAt(i);
mShmAllocator->DeallocShmem(shm);
mSmallAllocs.RemoveElementAt(i);