зеркало из https://github.com/mozilla/gecko-dev.git
Bug 578357 - Use fallible allocation for image frames.r=joe,cjones;a=blocker
This commit is contained in:
Родитель
77ec75576a
Коммит
4114ad3659
|
@ -98,9 +98,12 @@ gfxImageSurface::gfxImageSurface(const gfxIntSize& size, gfxImageFormat format)
|
|||
|
||||
// if we have a zero-sized surface, just leave mData nsnull
|
||||
if (mSize.height * mStride > 0) {
|
||||
mData = (unsigned char *) calloc(mSize.height, mStride);
|
||||
|
||||
// Use the fallible allocator here
|
||||
mData = (unsigned char *) moz_malloc(mSize.height * mStride);
|
||||
if (!mData)
|
||||
return;
|
||||
memset(mData, 0, mSize.height * mStride);
|
||||
}
|
||||
|
||||
mOwnsData = PR_TRUE;
|
||||
|
|
|
@ -216,7 +216,8 @@ nsresult imgFrame::Init(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mPalettedImageData = (PRUint8*)PR_MALLOC(PaletteDataLength() + GetImageDataLength());
|
||||
// Use the fallible allocator here
|
||||
mPalettedImageData = (PRUint8*)moz_malloc(PaletteDataLength() + GetImageDataLength());
|
||||
NS_ENSURE_TRUE(mPalettedImageData, NS_ERROR_OUT_OF_MEMORY);
|
||||
} else {
|
||||
// For Windows, we must create the device surface first (if we're
|
||||
|
|
Загрузка…
Ссылка в новой задаче