summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_function.cpp7
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp6
2 files changed, 6 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp
index bf5c3e065f..d4fad9c1ba 100644
--- a/core/fpdfapi/page/cpdf_function.cpp
+++ b/core/fpdfapi/page/cpdf_function.cpp
@@ -105,12 +105,11 @@ bool CPDF_Function::Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) {
uint32_t old_outputs = m_nOutputs;
if (!v_Init(pObj, pVisited))
return false;
+
if (m_pRanges && m_nOutputs > old_outputs) {
m_pRanges = FX_Realloc(float, m_pRanges, m_nOutputs * 2);
- if (m_pRanges) {
- memset(m_pRanges + (old_outputs * 2), 0,
- sizeof(float) * (m_nOutputs - old_outputs) * 2);
- }
+ memset(m_pRanges + (old_outputs * 2), 0,
+ sizeof(float) * (m_nOutputs - old_outputs) * 2);
}
return true;
}
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 4588cd13f3..f2799dcb45 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -305,7 +305,7 @@ bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule,
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) /
FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_TryRealloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
@@ -576,7 +576,7 @@ bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) /
FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_TryRealloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
@@ -863,7 +863,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
}
m_SrcSize = (dwSize + dwAvail + FXCODEC_BLOCK_SIZE - 1) /
FXCODEC_BLOCK_SIZE * FXCODEC_BLOCK_SIZE;
- m_pSrcBuf = FX_Realloc(uint8_t, m_pSrcBuf, m_SrcSize);
+ m_pSrcBuf = FX_TryRealloc(uint8_t, m_pSrcBuf, m_SrcSize);
if (!m_pSrcBuf) {
err_status = FXCODEC_STATUS_ERR_MEMORY;
return false;