diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index e55738634..8bfc2c527 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -168,19 +168,19 @@ std::string eosTypeString(int ieos, int length) ThermoPhase* newPhase(XML_Node& xmlphase) { string model = xmlphase.child("thermo")["model"]; - ThermoPhase* t = newThermoPhase(model); + unique_ptr t(newThermoPhase(model)); if (model == "singing cows") { throw CanteraError("ThermoPhase::newPhase", "Cows don't sing"); } else if (model == "HMW") { - HMWSoln* p = dynamic_cast(t); + HMWSoln* p = dynamic_cast(t.get()); p->constructPhaseXML(xmlphase,""); } else if (model == "IonsFromNeutralMolecule") { - IonsFromNeutralVPSSTP* p = dynamic_cast(t); + IonsFromNeutralVPSSTP* p = dynamic_cast(t.get()); p->constructPhaseXML(xmlphase,""); } else { - importPhase(xmlphase, t); + importPhase(xmlphase, t.get()); } - return t; + return t.release(); } ThermoPhase* newPhase(const std::string& infile, std::string id)