diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-05-16 15:56:53 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-05-16 15:56:53 -0700 |
commit | d3743ea4e62e870724be26d423c90204c8639463 (patch) | |
tree | f54ee0cd640a9480341844dac86a4178892c94e5 /xfa/fxfa/parser/xfa_object_imp.cpp | |
parent | fa34e805fd03ba81bcfe1148cf96b24fe63b39a0 (diff) | |
download | pdfium-d3743ea4e62e870724be26d423c90204c8639463.tar.xz |
Revert "Replace Release() { delete this; } in fde_xml_imp.h"
This reverts commit fa34e805fd03ba81bcfe1148cf96b24fe63b39a0.
Reason for revert: broke asan tests.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1982843002 .
Diffstat (limited to 'xfa/fxfa/parser/xfa_object_imp.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index f9887825f5..0fbde1f160 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -120,10 +120,10 @@ CXFA_Node::~CXFA_Node() { delete pNode; pNode = pNext; } - if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode)) - delete m_pXMLNode; + if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode)) { + m_pXMLNode->Release(); + } } - CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); @@ -962,12 +962,17 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { if (iLength >= 3) { bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; } - std::unique_ptr<IXFA_Parser> pParser(IXFA_Parser::Create(m_pDocument)); + IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument); + if (!pParser) { + return; + } CFDE_XMLNode* pXMLNode = NULL; int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL); - if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) + if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) { + pParser->Release(); + pParser = NULL; return; - + } if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element || XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) { @@ -1054,11 +1059,14 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { } pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false); } else { - delete pFakeXMLRoot; - pFakeXMLRoot = nullptr; + if (pFakeXMLRoot) { + pFakeXMLRoot->Release(); + pFakeXMLRoot = NULL; + } } + pParser->Release(); + pParser = NULL; } - void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) { } |