Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 13901
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: olivier.salaun [...] cru.fr
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.58
Fixed in: (no value)



Subject: free(): invalid pointer
We are using XML::LibXML as the XML parser in the mailing list server we are developing, Sympa (http://www.sympa.org). With recent versions of libxml2 (2.6.16 ; Fedora core 3) we are having fatal error while parsing an XML file and splitting it into N xml files, one for each node. Attached is a simplified perl script that demonstrates the problem. Before you run it, change the path to an existing XML file. You should get the following error : $ perl /usr/local/sympa/src/tools/testxml.pl *** glibc detected *** free(): invalid pointer: 0x080660d3 *** Abort (core dumped) Now try uncommenting the parse_file() line and comment the parse_fh() line. That's a really strange behavior that seems somehow related to the use of the setDocumentElement() method.
#!/usr/bin/perl ## Simple script to demonstate the "free(): invalid pointer" bug use XML::LibXML; my $parser = XML::LibXML->new(); my $xml_fh; open $xml_fh, '/tmp/anydata.xml' || die; my $doc; ## keep one of these lines commented #$doc = $parser->parse_file('/tmp/anydata.xml'); $doc = $parser->parse_fh($xml_fh); my $root = $doc->documentElement(); my @nodes = $root->childNodes(); foreach my $list_elt (@nodes) { my $list_doc = XML::LibXML::Document->createDocument($doc->version(),$doc->encoding()); $list_doc->setDocumentElement($list_elt); $list_doc->toFile('/tmp/last_elt.xml'); }