Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: core/src/fxge/dib/fx_dib_main.cpp

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/dib/fx_dib_engine.cpp ('k') | core/src/fxge/ge/fx_ge_font.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/dib/fx_dib_main.cpp
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index f55b2f573741a2eceadd9b3edbc28f8f7759f0ee..a54c9abed045d19c0492d3789e2ee1443270d84b 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -85,12 +85,12 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY
int oomlimit = _MAX_OOM_LIMIT_;
if (oomlimit >= 0 && size >= oomlimit) {
m_pBuffer = FX_TryAlloc(FX_BYTE, size);
- if (m_pBuffer == NULL) {
- return FALSE;
- }
} else {
m_pBuffer = FX_Alloc(FX_BYTE, size);
}
+ if (m_pBuffer == NULL) {
+ return FALSE;
+ }
}
m_Width = width;
m_Height = height;
@@ -202,6 +202,9 @@ void CFX_DIBSource::BuildPalette()
}
if (GetBPP() == 1) {
m_pPalette = FX_Alloc(FX_DWORD, 2);
+ if (!m_pPalette) {
+ return;
+ }
if(IsCmykImage()) {
m_pPalette[0] = 0xff;
m_pPalette[1] = 0;
@@ -211,6 +214,9 @@ void CFX_DIBSource::BuildPalette()
}
} else if (GetBPP() == 8) {
m_pPalette = FX_Alloc(FX_DWORD, 256);
+ if (!m_pPalette) {
+ return;
+ }
if(IsCmykImage()) {
for (int i = 0; i < 256; i ++) {
m_pPalette[i] = 0xff - i;
@@ -525,6 +531,9 @@ void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size)
if (m_pPalette == NULL) {
m_pPalette = FX_Alloc(FX_DWORD, pal_size);
}
+ if (!m_pPalette) {
+ return;
+ }
if (pal_size > size) {
pal_size = size;
}
« no previous file with comments | « core/src/fxge/dib/fx_dib_engine.cpp ('k') | core/src/fxge/ge/fx_ge_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698