Bug 1044193 - Always cleanup on heap allocation path, r=glandium

This commit is contained in:
Michael Wu 2014-08-05 02:19:59 -04:00
parent f7a4a85952
commit 597e1d3236

View File

@ -52,8 +52,6 @@ VolatileBuffer::Init(size_t aSize, size_t aAlignment)
}
if (ioctl(mFd, ASHMEM_SET_SIZE, mSize) < 0) {
close(mFd);
mFd = -1;
goto heap_alloc;
}
@ -63,6 +61,12 @@ VolatileBuffer::Init(size_t aSize, size_t aAlignment)
}
heap_alloc:
mBuf = nullptr;
if (mFd >= 0) {
close(mFd);
mFd = -1;
}
#ifdef MOZ_MEMORY
#ifdef MOZ_WIDGET_ANDROID
__wrap_posix_memalign(&mBuf, aAlignment, aSize);