(Sent to list, CC'd for convenience)

I've been planning (sorry...) to submit a patch to the libxml2
documentation to note that the call xsltParseStylesheetDoc takes
ownership of the document that is passed to it (i.e., guarantees to
release it appropriately), so that code using this function must not
free the document.  Indeed, the document may be modified as a result of
passing it to xsltParseStylesheetDoc.

I'm guessing it's quite possible that the Python wrapper calls this
function and therefore has the same problems as our in-house C++
wrappers did before I changed them to relinquish ownership when calling
xsltParseStylesheetDoc.

-- James


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of
> Nic James Ferrier
> Sent: Tuesday, January 09, 2007 3:52 PM
> To: libxml
> Subject: [xml] stylesheet imports and memory management
> 
> I've got a problem with the memory management of libxslt with some
> python code.
> 
> 
> I've got xslts in python doing imports through a (python) loader
> function.
> 
> The loader function uses either:
> 
>    parserContext.ctxReadFile
> 
> or:
> 
>   transformContext.ctxReadFile
> 
> to read in the resource for the import.
> 
> My loader function implementation records the relevant document
> objects so they can be freed later. This is my understanding of what
> the function has to do.
> 
> Later on, after the result of the transformation has been finished
> with, I free the documents that were created by the XSLT imports.
> 
> Directly afterwards I free the stylesheet and I get a glibc double
> free error.
> 
> It looks like libxslt is trying to free any documents is has got from
> the loader function implementation.
> 
> 
> Is this correct? It seems to run contrary to the documentation.
> 
> --
> Nic Ferrier
> http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/
> [email protected]
> http://mail.gnome.org/mailman/listinfo/xml
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to