yoreek / XML-Hash-XS

Convert hash to xml
Other
4 stars 4 forks source link

memory allocation problem? #4

Closed phillup closed 9 years ago

phillup commented 9 years ago

The following test case presents a memory allocation error:

#! /usr/bin/env perl

use Modern::Perl;

use XML::Hash::XS;
use Data::Dumper;

my $test = <<'XML';
<root>
    <row>
        <cell text="test&apos;s"/>
    </row>
    <row>
        <cell text=" test&apos;s"/>
    </row>
</root>
XML

say Dumper(xml2hash($test));

Notice the space in the second cell text. The second cell must be longer than the first, and also contain an escaped xml entity.

The error is: perl(64793,0x7fff76f6b310) malloc: *** error for object 0x7fc852c901b0: pointer being freed was not allocated

This is perl 5.16.0 and the module is v. 0.39

yoreek commented 9 years ago

good catching! :) fixed in v0.40

phillup commented 9 years ago

Thanks for the quick fix