diff options
author | Lei Zhang <thestig@chromium.org> | 2015-06-19 14:51:10 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-06-19 14:51:10 -0700 |
commit | cfac954abcab7caf47d3fa3d641c553cba998271 (patch) | |
tree | 4cd546a2377e973fec54b75c1002c8c0ff321e8f /core/src/fpdfapi/fpdf_parser | |
parent | df558514bf5cb5750d5a7000a843f45f4170d5a4 (diff) | |
download | pdfium-cfac954abcab7caf47d3fa3d641c553cba998271.tar.xz |
Cleanup: Do not check pointers before deleting them.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1192743004.
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 26 |
2 files changed, 12 insertions, 26 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index ac48dc6c65..efe085c2ee 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -18,9 +18,7 @@ CFX_DataFilter::CFX_DataFilter() } CFX_DataFilter::~CFX_DataFilter() { - if (m_pDestFilter) { - delete m_pDestFilter; - } + delete m_pDestFilter; } void CFX_DataFilter::SetDestFilter(CFX_DataFilter* pFilter) { @@ -192,12 +190,8 @@ CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_BOOL bRaw) const } CPDF_StreamFilter::~CPDF_StreamFilter() { - if (m_pFilter) { - delete m_pFilter; - } - if (m_pBuffer) { - delete m_pBuffer; - } + delete m_pFilter; + delete m_pBuffer; } #define FPDF_FILTER_BUFFER_IN_SIZE FPDF_FILTER_BUFFER_SIZE FX_DWORD CPDF_StreamFilter::ReadBlock(uint8_t* buffer, FX_DWORD buf_size) diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 56df7f3a0c..685ee047aa 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -68,7 +68,7 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) void CPDF_Parser::CloseParser(FX_BOOL bReParse) { m_bVersionUpdated = FALSE; - if (m_pDocument && !bReParse) { + if (!bReParse) { delete m_pDocument; m_pDocument = NULL; } @@ -309,11 +309,9 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() } void CPDF_Parser::ReleaseEncryptHandler() { - if (m_Syntax.m_pCryptoHandler) { - delete m_Syntax.m_pCryptoHandler; - m_Syntax.m_pCryptoHandler = NULL; - } - if (m_pSecurityHandler && !m_bForceUseSecurityHandler) { + delete m_Syntax.m_pCryptoHandler; + m_Syntax.m_pCryptoHandler = NULL; + if (!m_bForceUseSecurityHandler) { delete m_pSecurityHandler; m_pSecurityHandler = NULL; } @@ -1482,7 +1480,7 @@ FX_BOOL CPDF_Parser::IsOwner() void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler, FX_BOOL bForced) { ASSERT(m_pSecurityHandler == NULL); - if (m_pSecurityHandler && !m_bForceUseSecurityHandler) { + if (!m_bForceUseSecurityHandler) { delete m_pSecurityHandler; m_pSecurityHandler = NULL; } @@ -2984,12 +2982,8 @@ CPDF_DataAvail::~CPDF_DataAvail() if (m_pTrailer) { m_pTrailer->Release(); } - if (m_pageMapCheckState) { - delete m_pageMapCheckState; - } - if (m_pagesLoadState) { - delete m_pagesLoadState; - } + delete m_pageMapCheckState; + delete m_pagesLoadState; int32_t i = 0; int32_t iSize = m_arrayAcroforms.GetSize(); for (i = 0; i < iSize; ++i) { @@ -4640,10 +4634,8 @@ CPDF_PageNode::~CPDF_PageNode() { int32_t iSize = m_childNode.GetSize(); for (int32_t i = 0; i < iSize; ++i) { - CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; - if (pNode) { - delete pNode; - } + CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; + delete pNode; } m_childNode.RemoveAll(); } |