Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2117)

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp

Issue 1297713003: Don't bother checking pointers before delete[] and FX_Free(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 1ee062ee7c72f42586bbf5b07a3960ed0269983d..8c909a9e6830b544d5902a7687f0aaab7240c6ba 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -487,12 +487,8 @@ CPDF_SampledFunc::CPDF_SampledFunc() {
}
CPDF_SampledFunc::~CPDF_SampledFunc() {
delete m_pSampleStream;
- if (m_pEncodeInfo) {
- FX_Free(m_pEncodeInfo);
- }
- if (m_pDecodeInfo) {
- FX_Free(m_pDecodeInfo);
- }
+ FX_Free(m_pEncodeInfo);
+ FX_Free(m_pDecodeInfo);
}
FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
if (pObj->GetType() != PDFOBJ_STREAM) {
@@ -678,12 +674,8 @@ CPDF_ExpIntFunc::CPDF_ExpIntFunc() {
m_pEndValues = NULL;
}
CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
- if (m_pBeginValues) {
FX_Free(m_pBeginValues);
- }
- if (m_pEndValues) {
FX_Free(m_pEndValues);
- }
}
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
@@ -747,15 +739,9 @@ CPDF_StitchFunc::CPDF_StitchFunc() {
CPDF_StitchFunc::~CPDF_StitchFunc() {
for (int i = 0; i < m_nSubs; i++)
delete m_pSubFunctions[i];
- if (m_pSubFunctions) {
- FX_Free(m_pSubFunctions);
- }
- if (m_pBounds) {
- FX_Free(m_pBounds);
- }
- if (m_pEncode) {
- FX_Free(m_pEncode);
- }
+ FX_Free(m_pSubFunctions);
+ FX_Free(m_pBounds);
+ FX_Free(m_pEncode);
}
FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
@@ -859,14 +845,8 @@ CPDF_Function::CPDF_Function() {
m_pRanges = NULL;
}
CPDF_Function::~CPDF_Function() {
- if (m_pDomains) {
- FX_Free(m_pDomains);
- m_pDomains = NULL;
- }
- if (m_pRanges) {
- FX_Free(m_pRanges);
- m_pRanges = NULL;
- }
+ FX_Free(m_pDomains);
+ FX_Free(m_pRanges);
}
FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict;
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698