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

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

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 6 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_pattern.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index bd53874af4c6a3feb34f01091a71690315e8106e..48b3a40495d3331054483c497ad18409765e2ff3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -34,10 +34,8 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter
}
CPDF_TilingPattern::~CPDF_TilingPattern()
{
- if (m_pForm) {
- delete m_pForm;
- m_pForm = NULL;
- }
+ delete m_pForm;
+ m_pForm = NULL;
}
FX_BOOL CPDF_TilingPattern::Load()
{
@@ -92,9 +90,7 @@ CPDF_ShadingPattern::~CPDF_ShadingPattern()
void CPDF_ShadingPattern::Clear()
{
for (int i = 0; i < m_nFuncs; i ++) {
- if (m_pFunctions[i]) {
- delete m_pFunctions[i];
- }
+ delete m_pFunctions[i];
m_pFunctions[i] = NULL;
}
CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : NULL;
@@ -117,9 +113,7 @@ FX_BOOL CPDF_ShadingPattern::Load()
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
- if (m_pFunctions[i]) {
- delete m_pFunctions[i];
- }
+ delete m_pFunctions[i];
m_nFuncs = 0;
}
CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));

Powered by Google App Engine
This is Rietveld 408576698