diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index 6eed3f985..01408e51c 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -98,11 +98,11 @@ FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) : setChemicalPotential(val); // Create an XML_Node entry for this species - XML_Node* s = new XML_Node("species", 0); - s->addAttribute("name", pname); + XML_Node s("species", 0); + s.addAttribute("name", pname); std::string aaS = Ename + ":1"; - s->addChild("atomArray", aaS); - XML_Node& tt = s->addChild("thermo"); + s.addChild("atomArray", aaS); + XML_Node& tt = s.addChild("thermo"); XML_Node& ss = tt.addChild("Simple"); ss.addAttribute("Pref", "1 bar"); ss.addAttribute("Tmax", "5000."); @@ -112,9 +112,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) : std::string sval = fp2str(val); ss.addChild("h", sval); ss.addChild("s", "0.0"); - saveSpeciesData(0, s); - delete s; - s = 0; + saveSpeciesData(0, &s); } FixedChemPotSSTP::FixedChemPotSSTP(const FixedChemPotSSTP& right) diff --git a/src/thermo/HMWSoln_input.cpp b/src/thermo/HMWSoln_input.cpp index 4381559a5..a0eede497 100644 --- a/src/thermo/HMWSoln_input.cpp +++ b/src/thermo/HMWSoln_input.cpp @@ -979,10 +979,9 @@ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id_) * The phase object automatically constructs an XML object. * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id_); - + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id_); if (!fxml_phase) { throw CanteraError("HMWSoln:constructPhaseFile", "ERROR: Can not find phase named " + @@ -990,7 +989,6 @@ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id_) } setXMLdata(*fxml_phase); constructPhaseXML(*fxml_phase, id_); - delete fxml; } void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id_) diff --git a/src/thermo/PDSS_ConstVol.cpp b/src/thermo/PDSS_ConstVol.cpp index 09af9678a..e23f8e020 100644 --- a/src/thermo/PDSS_ConstVol.cpp +++ b/src/thermo/PDSS_ConstVol.cpp @@ -110,9 +110,9 @@ void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id); if (!fxml_phase) { throw CanteraError("PDSS_ConstVol::initThermo", "ERROR: Can not find phase named " + @@ -125,7 +125,6 @@ void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); constructPDSSXML(tp, spindex, *s, *fxml_phase, true); - delete fxml; } void PDSS_ConstVol::initThermoXML(const XML_Node& phaseNode, const std::string& id) diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index a48a95ede..0ad33579a 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -709,9 +709,9 @@ void PDSS_HKFT::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id); if (!fxml_phase) { throw CanteraError("PDSS_HKFT::initThermo", "ERROR: Can not find phase named " + @@ -724,7 +724,6 @@ void PDSS_HKFT::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); constructPDSSXML(tp, spindex, *s, *fxml_phase, true); - delete fxml; } #ifdef DEBUG_MODE diff --git a/src/thermo/PDSS_IdealGas.cpp b/src/thermo/PDSS_IdealGas.cpp index d70897b01..b0e999f2d 100644 --- a/src/thermo/PDSS_IdealGas.cpp +++ b/src/thermo/PDSS_IdealGas.cpp @@ -91,16 +91,15 @@ void PDSS_IdealGas::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id); if (!fxml_phase) { throw CanteraError("PDSS_IdealGas::constructPDSSFile", "ERROR: Can not find phase named " + id + " in file named " + inputFile); } constructPDSSXML(tp, spindex, *fxml_phase, id); - delete fxml; } void PDSS_IdealGas::initThermo() diff --git a/src/thermo/PDSS_IonsFromNeutral.cpp b/src/thermo/PDSS_IonsFromNeutral.cpp index f4c9bf244..b06e770a2 100644 --- a/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/src/thermo/PDSS_IonsFromNeutral.cpp @@ -181,9 +181,9 @@ void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spind * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id); if (!fxml_phase) { throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile", "ERROR: Can not find phase named " + @@ -196,7 +196,6 @@ void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spind const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); constructPDSSXML(tp, spindex, *s, *fxml_phase, id); - delete fxml; } void PDSS_IonsFromNeutral::initThermo() diff --git a/src/thermo/PDSS_SSVol.cpp b/src/thermo/PDSS_SSVol.cpp index de3de73c7..1657f140d 100644 --- a/src/thermo/PDSS_SSVol.cpp +++ b/src/thermo/PDSS_SSVol.cpp @@ -139,9 +139,9 @@ void PDSS_SSVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, * Use this object to store information. */ - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); + XML_Node fxml; + fxml.build(fin); + XML_Node* fxml_phase = findXMLPhase(&fxml, id); if (!fxml_phase) { throw CanteraError("PDSS_SSVol::initThermo", "ERROR: Can not find phase named " + @@ -154,7 +154,6 @@ void PDSS_SSVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex)); constructPDSSXML(tp, spindex, *s, *fxml_phase, true); - delete fxml; } void PDSS_SSVol::initThermoXML(const XML_Node& phaseNode, const std::string& id)