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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "../../../include/fpdfapi/fpdf_module.h" 9 #include "../../../include/fpdfapi/fpdf_module.h"
10 #include "../../../include/fpdfapi/fpdf_page.h" 10 #include "../../../include/fpdfapi/fpdf_page.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 CPDF_StreamAcc* m_pSampleStream; 453 CPDF_StreamAcc* m_pSampleStream;
454 }; 454 };
455 CPDF_SampledFunc::CPDF_SampledFunc() 455 CPDF_SampledFunc::CPDF_SampledFunc()
456 { 456 {
457 m_pSampleStream = NULL; 457 m_pSampleStream = NULL;
458 m_pEncodeInfo = NULL; 458 m_pEncodeInfo = NULL;
459 m_pDecodeInfo = NULL; 459 m_pDecodeInfo = NULL;
460 } 460 }
461 CPDF_SampledFunc::~CPDF_SampledFunc() 461 CPDF_SampledFunc::~CPDF_SampledFunc()
462 { 462 {
463 if (m_pSampleStream) { 463 delete m_pSampleStream;
464 delete m_pSampleStream;
465 }
466 if (m_pEncodeInfo) { 464 if (m_pEncodeInfo) {
467 FX_Free(m_pEncodeInfo); 465 FX_Free(m_pEncodeInfo);
468 } 466 }
469 if (m_pDecodeInfo) { 467 if (m_pDecodeInfo) {
470 FX_Free(m_pDecodeInfo); 468 FX_Free(m_pDecodeInfo);
471 } 469 }
472 } 470 }
473 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) 471 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
474 { 472 {
475 if (pObj->GetType() != PDFOBJ_STREAM) { 473 if (pObj->GetType() != PDFOBJ_STREAM) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 CPDF_StitchFunc::CPDF_StitchFunc() 704 CPDF_StitchFunc::CPDF_StitchFunc()
707 { 705 {
708 m_nSubs = 0; 706 m_nSubs = 0;
709 m_pSubFunctions = NULL; 707 m_pSubFunctions = NULL;
710 m_pBounds = NULL; 708 m_pBounds = NULL;
711 m_pEncode = NULL; 709 m_pEncode = NULL;
712 } 710 }
713 CPDF_StitchFunc::~CPDF_StitchFunc() 711 CPDF_StitchFunc::~CPDF_StitchFunc()
714 { 712 {
715 for (int i = 0; i < m_nSubs; i ++) 713 for (int i = 0; i < m_nSubs; i ++)
716 if (m_pSubFunctions[i]) { 714 delete m_pSubFunctions[i];
717 delete m_pSubFunctions[i];
718 }
719 if (m_pSubFunctions) { 715 if (m_pSubFunctions) {
720 FX_Free(m_pSubFunctions); 716 FX_Free(m_pSubFunctions);
721 } 717 }
722 if (m_pBounds) { 718 if (m_pBounds) {
723 FX_Free(m_pBounds); 719 FX_Free(m_pBounds);
724 } 720 }
725 if (m_pEncode) { 721 if (m_pEncode) {
726 FX_Free(m_pEncode); 722 FX_Free(m_pEncode);
727 } 723 }
728 } 724 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 for (int i = 0; i < m_nOutputs; i ++) { 892 for (int i = 0; i < m_nOutputs; i ++) {
897 if (results[i] < m_pRanges[i * 2]) { 893 if (results[i] < m_pRanges[i * 2]) {
898 results[i] = m_pRanges[i * 2]; 894 results[i] = m_pRanges[i * 2];
899 } else if (results[i] > m_pRanges[i * 2 + 1]) { 895 } else if (results[i] > m_pRanges[i * 2 + 1]) {
900 results[i] = m_pRanges[i * 2 + 1]; 896 results[i] = m_pRanges[i * 2 + 1];
901 } 897 }
902 } 898 }
903 } 899 }
904 return TRUE; 900 return TRUE;
905 } 901 }
OLDNEW
« 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