On Tue, Jul 07, 2009 at 10:37:46AM +0100, Tony Graham wrote:
> The function is currently leaking the xmlNode created from
> '<hello-world/>'. The leak occurs with various libxslt versions,
> including the latest SVN checkout.
[...]
> xmlDocPtr container = xsltCreateRVT (tctxt);
> if (container != NULL)
> {
> xsltRegisterLocalRVT (tctxt,
> container);
> ret = xmlXPathNewNodeSet (NULL);
> if (ret != NULL)
> {
> xmlNodePtr new_node = xmlDocCopyNodeList (container,
> doc->children);
> while (new_node != NULL)
> {
> xmlXPathNodeSetAdd (ret->nodesetval,
> new_node);
> new_node = new_node->next;
> }
> /*
> * Mark it as a function result in order to avoid garbage
> * collecting of tree fragments
> */
> xsltExtensionInstructionResultRegister(tctxt,
> ret);
> }
> }
> }
the new_nodes are inserted in the nodeset but never actually attached
to the container , so when it goes out of scope, the container is freed
but since your copied nodes were not attached to it they are still
leaked.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
[email protected] | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt