whit wrote:
after installing the latest egg, I have been having issues with seg faults, bus error and been get lots of errors like these:
python(300) malloc: *** Deallocation of a pointer not malloced: 0x628d30; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(300) malloc: *** error for object 0x629910: double free python(300) malloc: *** set a breakpoint in szone_error to debug
below are the style sheet and function that expose the problem.
I'm using:
libxslt 1.1.15 libxml 2.6.22 lxml 0.9(trunk)
gcc-4.0 (osx, tiger) pyrex (svn from codespeak)
Hi, thanks for reporting this. I cleaned up your test case somewhat and came up with this: ---------------------------- slug = """ <div><some tag="true"> <other /> </some> </div> """ xslt = """\ <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet> """ from lxml import etree xslt_doc = etree.XML(xslt) style = etree.XSLT(xslt_doc) doc = etree.XML(slug) result = style(doc) print 1 del result print 2 ---------------------------- This triggers a double free in _Document.__dealloc__() calling xmlFreeDoc() when result is GCed on "del result". This is exactly the same problem I had with the HTML parser branch. It is triggered because you use "html" as output method, which makes libxslt output HTML trees with HTML document nodes instead of XML document nodes. I've applied the fix to trunk and 0.9 branch. Please test it. Stefan