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

Side by Side Diff: xfa/fxfa/parser/xfa_parser_imp.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « xfa/fxfa/parser/xfa_locale.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "xfa/fxfa/parser/xfa_parser_imp.h" 7 #include "xfa/fxfa/parser/xfa_parser_imp.h"
8 8
9 #include "xfa/fde/xml/fde_xml_imp.h" 9 #include "xfa/fde/xml/fde_xml_imp.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 CFDE_XMLNode* pXMLNode) { 1383 CFDE_XMLNode* pXMLNode) {
1384 if (!pXFANode || !pXMLNode) { 1384 if (!pXFANode || !pXMLNode) {
1385 return; 1385 return;
1386 } 1386 }
1387 m_nodeParser.ConstructXFANode(pXFANode, pXMLNode); 1387 m_nodeParser.ConstructXFANode(pXFANode, pXMLNode);
1388 CXFA_Node* pRootNode = m_nodeParser.GetRootNode(); 1388 CXFA_Node* pRootNode = m_nodeParser.GetRootNode();
1389 if (m_pDocument && pRootNode) { 1389 if (m_pDocument && pRootNode) {
1390 m_pDocument->SetRoot(pRootNode); 1390 m_pDocument->SetRoot(pRootNode);
1391 } 1391 }
1392 } 1392 }
1393
1393 void CXFA_DocumentParser::CloseParser() { 1394 void CXFA_DocumentParser::CloseParser() {
1394 if (m_pDocument) { 1395 delete m_pDocument;
1395 delete m_pDocument; 1396 m_pDocument = nullptr;
1396 m_pDocument = NULL;
1397 }
1398 m_nodeParser.CloseParser(); 1397 m_nodeParser.CloseParser();
1399 } 1398 }
1399
1400 CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream) 1400 CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream)
1401 : m_nElementStart(0), 1401 : m_nElementStart(0),
1402 m_dwCheckStatus(0), 1402 m_dwCheckStatus(0),
1403 m_dwCurrentCheckStatus(0), 1403 m_dwCurrentCheckStatus(0),
1404 m_pRoot(pRoot), 1404 m_pRoot(pRoot),
1405 m_pStream(pStream), 1405 m_pStream(pStream),
1406 m_pParser(nullptr), 1406 m_pParser(nullptr),
1407 m_pParent(pRoot), 1407 m_pParent(pRoot),
1408 m_pChild(nullptr), 1408 m_pChild(nullptr),
1409 m_NodeStack(16), 1409 m_NodeStack(16),
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 } 1556 }
1557 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { 1557 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
1558 break; 1558 break;
1559 } 1559 }
1560 } 1560 }
1561 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error || 1561 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
1562 m_NodeStack.GetSize() != 1) 1562 m_NodeStack.GetSize() != 1)
1563 ? -1 1563 ? -1
1564 : m_pParser->GetStatus(); 1564 : m_pParser->GetStatus();
1565 } 1565 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_locale.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698