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

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: 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 87ff0a3b634a209074cd22d70f367120446f0c57..b2a186b5d2b278f79518fb4510ba726307777df3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -482,12 +482,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_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
if (pObj->GetType() != PDFOBJ_STREAM) {
@@ -664,12 +660,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();
@@ -728,15 +720,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_pSubFunctions);
FX_Free(m_pBounds);
- }
- if (m_pEncode) {
FX_Free(m_pEncode);
- }
}
FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
@@ -840,14 +826,10 @@ CPDF_Function::CPDF_Function() {
m_pRanges = NULL;
}
CPDF_Function::~CPDF_Function() {
- if (m_pDomains) {
FX_Free(m_pDomains);
m_pDomains = NULL;
Tom Sepez 2015/08/14 21:21:34 nit: Pointless NULL assignment(s).
Lei Zhang 2015/08/14 21:43:14 Done.
- }
- if (m_pRanges) {
FX_Free(m_pRanges);
m_pRanges = NULL;
- }
}
FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict;

Powered by Google App Engine
This is Rietveld 408576698