summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
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/fpdfapi/fpdf_parser
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/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp9
3 files changed, 8 insertions, 21 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 55e648a054..125b7e0bf5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -1040,7 +1040,5 @@ CPDF_StandardCryptoHandler::CPDF_StandardCryptoHandler() {
m_KeyLen = 0;
}
CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() {
- if (m_pAESContext) {
- FX_Free(m_pAESContext);
- }
+ FX_Free(m_pAESContext);
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index d4deb1df3b..eed62013f5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -828,7 +828,7 @@ CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
m_pCryptoHandler = NULL;
}
CPDF_Stream::~CPDF_Stream() {
- if (m_GenNum == (FX_DWORD)-1 && m_pDataBuf != NULL) {
+ if (m_GenNum == (FX_DWORD)-1) {
FX_Free(m_pDataBuf);
}
if (m_pDict) {
@@ -843,9 +843,7 @@ void CPDF_Stream::InitStream(CPDF_Dictionary* pDict) {
m_pDict = pDict;
}
if (m_GenNum == (FX_DWORD)-1) {
- if (m_pDataBuf) {
- FX_Free(m_pDataBuf);
- }
+ FX_Free(m_pDataBuf);
}
m_GenNum = 0;
m_pFile = NULL;
@@ -871,9 +869,7 @@ void CPDF_Stream::SetData(const uint8_t* pData,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf) {
if (m_GenNum == (FX_DWORD)-1) {
- if (m_pDataBuf) {
- FX_Free(m_pDataBuf);
- }
+ FX_Free(m_pDataBuf);
} else {
m_GenNum = (FX_DWORD)-1;
m_pCryptoHandler = NULL;
@@ -1101,12 +1097,10 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
m_bNewBuf = m_pData != pStream->m_pDataBuf;
}
CPDF_StreamAcc::~CPDF_StreamAcc() {
- if (m_bNewBuf && m_pData) {
+ if (m_bNewBuf) {
FX_Free(m_pData);
}
- if (m_pSrcData) {
- FX_Free(m_pSrcData);
- }
+ FX_Free(m_pSrcData);
}
const uint8_t* CPDF_StreamAcc::GetData() const {
if (m_bNewBuf) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index e5d0b6a17b..e78ee4596d 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1735,9 +1735,7 @@ CPDF_SyntaxParser::CPDF_SyntaxParser() {
m_bFileStream = FALSE;
}
CPDF_SyntaxParser::~CPDF_SyntaxParser() {
- if (m_pFileBuf) {
- FX_Free(m_pFileBuf);
- }
+ FX_Free(m_pFileBuf);
}
FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch) {
FX_FILESIZE save_pos = m_Pos;
@@ -2598,10 +2596,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess,
FX_DWORD HeaderOffset) {
- if (m_pFileBuf) {
- FX_Free(m_pFileBuf);
- m_pFileBuf = NULL;
- }
+ FX_Free(m_pFileBuf);
m_pFileBuf = FX_Alloc(uint8_t, m_BufSize);
m_HeaderOffset = HeaderOffset;
m_FileLen = pFileAccess->GetSize();