GNOME Bugzilla – Bug 340400
Unresolved attribute-set reference will produce a memory-leak
Last modified: 2006-05-11 13:15:31 UTC
If an attribute-set reference (via "use-attribute-set") cannot be resolved, then in xsltMergeAttrElemList(), the strings in the fields @set and @ns fields of xsltAttrElem are duplicated, but never freed. On the other hand, if the reference can be resolved, then those duplicated strings are freed in xsltResolveSASCallback(). I think the best way to fix this is not to duplicate the strings, but to use the string-dict. Example: ======= <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute-set name="attr-set-2" use-attribute-sets="attr-set-1"> </xsl:attribute-set> </xsl:stylesheet> xsltproc results ================ $xsltproc attr-set-2.xsl xsl:attribute-set : use-attribute-sets attr-set-2 reference missing attr-set-1 memory dump =========== $cat .memdump MEMORY ALLOCATED : 11, MAX was 20817 BLOCK NUMBER SIZE TYPE 0 335 11 malloc() in none(0) "attr-set-1"
Fixed in CVS, attributes.c, revision 1.43