XMLParser: Fix "invalid read errors" reported by valgrind. Objects were removed before they were used again, which probably lead to the above mentioned crashs
ENDRELEASENOTES
crash
The crash can (maybe?) be reproduced with attached steering file (renamed to xml)
break.txt
==21315== Invalid read of size 8
==21315== at 0x4ECA406: TiXmlNode::NextSibling(char const*) const (tinyxml.cc:386)
==21315== by 0x4C8525B: IterateChildren (tinyxml.h:570)
==21315== by 0x4C8525B: marlin::XMLParser::parse() (XMLParser.cc:160)
==21315== by 0x40E5AE: main (Marlin.cc:277)
==21315== Address 0x145894c0 is 96 bytes inside a block of size 216 free'd
==21315== at 0x4A09186: operator delete(void*) (vg_replace_malloc.c:575)
==21315== by 0x4ECA2F3: TiXmlNode::RemoveChild(TiXmlNode*) (tinyxml.cc:327)
==21315== by 0x4C85417: marlin::XMLParser::parse() (XMLParser.cc:179)
==21315== by 0x40E5AE: main (Marlin.cc:277)
==21315== Block was alloc'd at
==21315== at 0x4A080BC: operator new(unsigned long) (vg_replace_malloc.c:333)
==21315== by 0x4ECF3A9: TiXmlNode::Identify(char const*, TiXmlEncoding) (tinyxmlparser.cc:892)
==21315== by 0x4ED0C45: TiXmlElement::ReadValue(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cc:1229)
==21315== by 0x4ED0FDE: TiXmlElement::Parse(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cc:1124)
==21315== by 0x4ECF50C: TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cc:767)
==21315== by 0x4ECAE0D: TiXmlDocument::LoadFile(_IO_FILE*, TiXmlEncoding) (tinyxml.cc:1077)
==21315== by 0x4ECB0A6: TiXmlDocument::LoadFile(char const*, TiXmlEncoding) (tinyxml.cc:953)
==21315== by 0x4C84002: LoadFile (tinyxml.h:1409)
==21315== by 0x4C84002: marlin::XMLParser::parse() (XMLParser.cc:28)
==21315== by 0x40E5AE: main (Marlin.cc:277)
BEGINRELEASENOTES
ENDRELEASENOTES
crash
The crash can (maybe?) be reproduced with attached steering file (renamed to xml) break.txt
invalid read
Example valgrind output