From ae90b6cd515f73497113d81e89831f091a4d6ad9 Mon Sep 17 00:00:00 2001 From: Iurii Puzanov Date: Mon, 18 Apr 2016 10:23:43 +0300 Subject: [PATCH] indigo-core: fixed CML saver (avoid memory leak) --- molecule/src/molecule_cml_saver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/molecule/src/molecule_cml_saver.cpp b/molecule/src/molecule_cml_saver.cpp index eb64d4f152..dbea93aff3 100644 --- a/molecule/src/molecule_cml_saver.cpp +++ b/molecule/src/molecule_cml_saver.cpp @@ -32,7 +32,7 @@ void MoleculeCmlSaver::saveMolecule (Molecule &mol) { LocaleGuard locale_guard; int i; - _doc = new TiXmlDocument(); + AutoPtr _doc(new TiXmlDocument()); _root = 0; _mol = &mol; @@ -243,6 +243,7 @@ void MoleculeCmlSaver::saveMolecule (Molecule &mol) TiXmlPrinter printer; _doc->Accept(&printer); _output.printf("%s", printer.CStr()); + _doc.release(); } void MoleculeCmlSaver::_addSgroupElement (TiXmlElement *molecule, SGroup &sgroup)