diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:56:52 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:56:52 -0700 |
commit | bf4aa2cc93a67826247e887b2ba26a1b965eb616 (patch) | |
tree | a1d6336676d6d70467a7fb94aa0e625b1dbc8c25 /core/src/fxcrt/extension.h | |
parent | eb6527763171cdb4b0fbfea5a20d691f4d67b660 (diff) | |
download | pdfium-bf4aa2cc93a67826247e887b2ba26a1b965eb616.tar.xz |
Revert "Remove FX_Alloc() null checks now that it can't return NULL."
This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660.
Reason for revert: broke javascript tests.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1145843005
Diffstat (limited to 'core/src/fxcrt/extension.h')
-rw-r--r-- | core/src/fxcrt/extension.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index c459bdcf99..dbee7e676a 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; } |