summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 17:26:17 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 17:26:17 -0700
commit6d8b1c2c7b1cbada20109f70ae971a4192330bb5 (patch)
treee755b7cb2624622cba606134493d25fb7f1ce6c8 /core/src/fpdfapi/fpdf_parser
parent9883a7da2d4f31910073c03e703d5b97a45d9254 (diff)
downloadpdfium-6d8b1c2c7b1cbada20109f70ae971a4192330bb5.tar.xz
Merge to XFA: Cleanup: Do not check pointers before deleting them.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004. (cherry picked from commit cfac954abcab7caf47d3fa3d641c553cba998271) Review URL: https://codereview.chromium.org/1196783003.
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp26
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 9f5acb5257..5e673b0829 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -72,7 +72,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;
}
@@ -313,11 +313,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;
}
@@ -1486,7 +1484,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;
}
@@ -2988,12 +2986,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) {
@@ -4644,10 +4638,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();
}