[lxml-dev] Bug report: double free or corruption

Executing the following script results in an error with lxml-0.6: from lxml.etree import Element,dump,parse root = Element('root') add = parse('test.xml') root.append(add.getroot()) dump(root) The "test.xml" file contains only one tag. The output of dump prints the expected xml, but after that the following error occures: *** glibc detected *** double free or corruption (out): 0x080b885b *** Aborted Regards, Florian

Hey, Thanks for this bug report. Pretty weird.. Florian Wagner wrote:
Even more bizarre is that a valgrind run of this script: from lxml.etree import Element, dump, parse root = Element('root') add = parse('test.xml') root.append(Element('baz')) results in memory errors as well. If I remove the parse call the thing is fine, even though 'add' is in fact never used. If I remove the .append call (and just parse) everything's fine too! This will need some digging; I think we're triggering some weird corner case of lxml's automatic management here that I didn't consider, and this type of stuff tends to be fairly hard to debug. Regards, Martijn

Hey, Thanks for this bug report. Pretty weird.. Florian Wagner wrote:
Even more bizarre is that a valgrind run of this script: from lxml.etree import Element, dump, parse root = Element('root') add = parse('test.xml') root.append(Element('baz')) results in memory errors as well. If I remove the parse call the thing is fine, even though 'add' is in fact never used. If I remove the .append call (and just parse) everything's fine too! This will need some digging; I think we're triggering some weird corner case of lxml's automatic management here that I didn't consider, and this type of stuff tends to be fairly hard to debug. Regards, Martijn
participants (2)
-
Florian Wagner
-
Martijn Faassen