rjray / rpc-xml

A Perl implementation of the XML-RPC specification
https://metacpan.org/release/RPC-XML
24 stars 14 forks source link

Fix leak caused by failing to free Expat parser. #11

Closed tgt closed 9 years ago

tgt commented 9 years ago

We don't want to return from the method until the parser's been freed. We therefore need to call $parser->release() before the return statements caused by request failures.

The documentation for XML::Parser::Expat says it uses data structures with circular references and release is therefore required when not called by higher level calls: https://metacpan.org/pod/distribution/libxml-enno/lib/XML/Parser/Expat.pod#release

I initially thought that we should call parse_done() whether or not parsing succeeded, but it seems that shouldn't be called when the parser has received nothing or invalid XML.

I wonder whether this is related to https://rt.cpan.org/Public/Bug/Display.html?id=41422

rjray commented 9 years ago

Merged. Will put this into a release soon, after I check to see if it might in fact be related to that RT ticket.