summaryrefslogtreecommitdiff
path: root/core/src/fxcodec
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 22:22:13 -0700
commitda180e9fdd4385df024cc18046f62ca47bc74d74 (patch)
tree931e0e64ac2cbc82e3718e43418ee6bd676da4a5 /core/src/fxcodec
parent2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (diff)
downloadpdfium-da180e9fdd4385df024cc18046f62ca47bc74d74.tar.xz
Merge to XFA: Don't bother checking pointers before delete[] and FX_Free().
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 . (cherry picked from commit cb62e7657b3a9a04142028a4e6614029a08e894b) Review URL: https://codereview.chromium.org/1287053005 .
Diffstat (limited to 'core/src/fxcodec')
-rw-r--r--core/src/fxcodec/codec/codec_int.h4
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp8
-rw-r--r--core/src/fxcodec/codec/fx_codec_fax.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp16
-rw-r--r--core/src/fxcodec/codec/fx_codec_icc.cpp4
-rw-r--r--core/src/fxcodec/codec/fx_codec_jbig.cpp12
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp8
7 files changed, 17 insertions, 51 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index be59655b4e..faf812051a 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -54,9 +54,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
int GetBPC() override { return m_bpc; }
FX_BOOL IsColorTransformed() override { return m_bColorTransformed; }
void ClearImageData() override {
- if (m_pDataCache) {
- FX_Free(m_pDataCache);
- }
+ FX_Free(m_pDataCache);
m_pDataCache = NULL;
}
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp
index 2cfb7469e0..b16beb5de1 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -25,9 +25,7 @@ CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() {
m_pLastScanline = NULL;
}
CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {
- if (m_pDataCache) {
- FX_Free(m_pDataCache);
- }
+ FX_Free(m_pDataCache);
}
uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) {
if (m_pDataCache && line < m_pDataCache->m_nCachedLines) {
@@ -600,9 +598,7 @@ CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder()
m_bEOD(FALSE),
m_Operator(0) {}
CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
+ FX_Free(m_pScanline);
}
FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
FX_DWORD i = 0;
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp
index 34c07ac484..63a45c7aea 100644
--- a/core/src/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/src/fxcodec/codec/fx_codec_fax.cpp
@@ -491,12 +491,8 @@ CCodec_FaxDecoder::CCodec_FaxDecoder() {
m_pRefBuf = NULL;
}
CCodec_FaxDecoder::~CCodec_FaxDecoder() {
- if (m_pScanlineBuf) {
- FX_Free(m_pScanlineBuf);
- }
- if (m_pRefBuf) {
- FX_Free(m_pRefBuf);
- }
+ FX_Free(m_pScanlineBuf);
+ FX_Free(m_pRefBuf);
}
FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf,
FX_DWORD src_size,
@@ -770,12 +766,8 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf,
m_DestBuf.EstimateSize(0, 10240);
}
CCodec_FaxEncoder::~CCodec_FaxEncoder() {
- if (m_pRefLine) {
- FX_Free(m_pRefLine);
- }
- if (m_pLineBuf) {
- FX_Free(m_pLineBuf);
- }
+ FX_Free(m_pRefLine);
+ FX_Free(m_pLineBuf);
}
void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) {
int dest_bitpos = 0;
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index a4b37c1ca3..e8878e4535 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -647,18 +647,10 @@ CCodec_FlateScanlineDecoder::CCodec_FlateScanlineDecoder() {
m_LeftOver = 0;
}
CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() {
- if (m_pScanline) {
- FX_Free(m_pScanline);
- }
- if (m_pLastLine) {
- FX_Free(m_pLastLine);
- }
- if (m_pPredictBuffer) {
- FX_Free(m_pPredictBuffer);
- }
- if (m_pPredictRaw) {
- FX_Free(m_pPredictRaw);
- }
+ FX_Free(m_pScanline);
+ FX_Free(m_pLastLine);
+ FX_Free(m_pPredictBuffer);
+ FX_Free(m_pPredictRaw);
if (m_pFlate) {
FPDFAPI_FlateEnd(m_pFlate);
}
diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp
index 856766e4ea..dad880a936 100644
--- a/core/src/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/src/fxcodec/codec/fx_codec_icc.cpp
@@ -392,9 +392,7 @@ CFX_IccTransformCache::~CFX_IccTransformCache() {
if (m_pIccTransform) {
cmsDeleteTransform(m_pIccTransform);
}
- if (m_pCmm) {
- FX_Free(m_pCmm);
- }
+ FX_Free(m_pCmm);
}
void CFX_IccTransformCache::Purge() {}
class CFX_ByteStringKey : public CFX_BinaryBuf {
diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp
index 9d78bba3bb..1551060b60 100644
--- a/core/src/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp
@@ -82,9 +82,7 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr,
FX_Free(src_buf);
return TRUE;
failed:
- if (src_buf) {
- FX_Free(src_buf);
- }
+ FX_Free(src_buf);
return FALSE;
}
FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
@@ -188,9 +186,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context,
FX_Free(m_pJbig2Context->m_src_buf);
return FXCODEC_STATUS_DECODE_FINISH;
failed:
- if (m_pJbig2Context->m_src_buf) {
- FX_Free(m_pJbig2Context->m_src_buf);
- }
+ FX_Free(m_pJbig2Context->m_src_buf);
m_pJbig2Context->m_src_buf = NULL;
return FXCODEC_STATUS_ERROR;
}
@@ -206,9 +202,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context,
CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
m_pJbig2Context->m_pContext = NULL;
if (ret != JBIG2_SUCCESS) {
- if (m_pJbig2Context->m_src_buf) {
- FX_Free(m_pJbig2Context->m_src_buf);
- }
+ FX_Free(m_pJbig2Context->m_src_buf);
m_pJbig2Context->m_src_buf = NULL;
return FXCODEC_STATUS_ERROR;
}
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index ae13e43bea..17e2bcf356 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -285,9 +285,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
}
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
- if (line_buf) {
- FX_Free(line_buf);
- }
+ FX_Free(line_buf);
dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
}
static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
@@ -420,9 +418,7 @@ CCodec_JpegDecoder::~CCodec_JpegDecoder() {
m_pExtProvider->DestroyDecoder(m_pExtContext);
return;
}
- if (m_pScanlineBuf) {
- FX_Free(m_pScanlineBuf);
- }
+ FX_Free(m_pScanlineBuf);
if (m_bInited) {
jpeg_destroy_decompress(&cinfo);
}