[libxml-devel] Memory leak with 0.9.6 and 0.9.7
Charlie Savage
cfis at savagexi.com
Thu Jan 8 00:42:35 EST 2009
Hey Aaron,
> Looks like the xmlOutputBufferPtr never gets freed.
Yup, exactly right. I posted a fix to trunk and sent another email to
the list, but somehow it never made it through.
> Index: ext/libxml/ruby_xml_node.c
> ===================================================================
> --- ext/libxml/ruby_xml_node.c (revision 693)
> +++ ext/libxml/ruby_xml_node.c (working copy)
> @@ -570,10 +570,16 @@
> xmlNodeDumpOutput(output, xnode->doc, xnode, level, indent, encoding);
> xmlOutputBufferFlush(output);
>
> + VALUE string = Qnil;
> +
> if (output->conv)
> - return rb_str_new2((const char*) output->conv->content);
> + string = rb_str_new2((const char*) output->conv->content);
> else
> - return rb_str_new2((const char*) output->buffer->content);
> + string = rb_str_new2((const char*) output->buffer->content);
> +
> + xmlOutputBufferClose(output);
> +
> + return string;
> }
>
Yup, trunk updated to do exactly this. Thanks for the patch.
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://rubyforge.org/pipermail/libxml-devel/attachments/20090107/ee5de10e/attachment-0001.bin>
More information about the libxml-devel
mailing list