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

Unified Diff: core/src/fxcrt/extension.h

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/fxcodec/codec/fx_codec_jpx_opj.cpp ('k') | core/src/fxcrt/fx_basic_array.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/extension.h
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index c459bdcf99609e37ba11c3c2fff4dcf30808b44d..dbee7e676a2c9ab9bcc88cbbfe52302cc42f074c 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -348,7 +348,9 @@ public:
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
if (m_Blocks.GetSize() < 1) {
FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, FX_MAX(nInitSize, 4096));
- m_Blocks.Add(pBlock);
+ if (pBlock) {
+ m_Blocks.Add(pBlock);
+ }
}
m_nGrowSize = FX_MAX(nGrowSize, 4096);
} else if (m_Blocks.GetSize() < 1) {
@@ -405,6 +407,9 @@ protected:
m_Blocks.SetSize(m_Blocks.GetSize() + (FX_INT32)size);
while (size --) {
FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, m_nGrowSize);
+ if (!pBlock) {
+ return FALSE;
+ }
m_Blocks.SetAt(iCount ++, pBlock);
m_nTotalSize += m_nGrowSize;
}
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jpx_opj.cpp ('k') | core/src/fxcrt/fx_basic_array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698