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

Unified Diff: core/src/fxcodec/codec/fx_codec_icc.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/fxcodec/codec/fx_codec_flate.cpp ('k') | core/src/fxcodec/codec/fx_codec_jbig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/codec/fx_codec_icc.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index 26b4c1adfc6eca02d4135f1edb7724eeedb8f360..a984fecc3001e7ff09832b759e51f4577031788d 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -285,6 +285,9 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile)
ICodec_IccModule::IccCS cs;
FX_DWORD dwSize = (FX_DWORD)pFile->GetSize();
FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, dwSize);
+ if (pBuf == NULL) {
+ return IccCS_Unknown;
+ }
pFile->ReadBlock(pBuf, 0, dwSize);
cs = GetProfileCS(pBuf, dwSize);
FX_Free(pBuf);
@@ -488,6 +491,9 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa
CFX_IccTransformCache* pTransformCache;
if (!m_MapTranform.Lookup(TransformKey, (FX_LPVOID&)pTransformCache)) {
pCmm = FX_Alloc(CLcmsCmm, 1);
+ if (pCmm == NULL) {
+ return NULL;
+ }
pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType);
pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType);
pCmm->m_bLab = T_COLORSPACE(pInputParam->dwFormat) == PT_Lab;
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_flate.cpp ('k') | core/src/fxcodec/codec/fx_codec_jbig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698