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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "pageint.h" 10 #include "pageint.h"
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 m_pData = NULL; 911 m_pData = NULL;
912 m_Status = Ready; 912 m_Status = Ready;
913 m_pType3Char = NULL; 913 m_pType3Char = NULL;
914 } 914 }
915 CPDF_ContentParser::~CPDF_ContentParser() 915 CPDF_ContentParser::~CPDF_ContentParser()
916 { 916 {
917 Clear(); 917 Clear();
918 } 918 }
919 void CPDF_ContentParser::Clear() 919 void CPDF_ContentParser::Clear()
920 { 920 {
921 if (m_pParser) { 921 delete m_pParser;
922 delete m_pParser; 922 delete m_pSingleStream;
923 }
924 if (m_pSingleStream) {
925 delete m_pSingleStream;
926 }
927 if (m_pStreamArray) { 923 if (m_pStreamArray) {
928 for (FX_DWORD i = 0; i < m_nStreams; i ++) 924 for (FX_DWORD i = 0; i < m_nStreams; i ++)
929 if (m_pStreamArray[i]) { 925 delete m_pStreamArray[i];
930 delete m_pStreamArray[i];
931 }
932 FX_Free(m_pStreamArray); 926 FX_Free(m_pStreamArray);
933 } 927 }
934 if (m_pData && m_pSingleStream == NULL) { 928 if (m_pData && m_pSingleStream == NULL) {
935 FX_Free((void*)m_pData); 929 FX_Free((void*)m_pData);
936 } 930 }
937 m_pParser = NULL; 931 m_pParser = NULL;
938 m_pStreamArray = NULL; 932 m_pStreamArray = NULL;
939 m_pSingleStream = NULL; 933 m_pSingleStream = NULL;
940 m_pData = NULL; 934 m_pData = NULL;
941 m_Status = Ready; 935 m_Status = Ready;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 return 100; 1135 return 100;
1142 } 1136 }
1143 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { 1137 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) {
1144 return 10; 1138 return 10;
1145 } 1139 }
1146 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { 1140 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) {
1147 return 90; 1141 return 90;
1148 } 1142 }
1149 return 10 + 80 * m_CurrentOffset / m_Size; 1143 return 10 + 80 * m_CurrentOffset / m_Size;
1150 } 1144 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698