After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 340400 - Unresolved attribute-set reference will produce a memory-leak
Unresolved attribute-set reference will produce a memory-leak
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-02 12:34 UTC by kbuchcik
Modified: 2006-05-11 13:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description kbuchcik 2006-05-02 12:34:17 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"
Comment 1 kbuchcik 2006-05-11 13:15:31 UTC
Fixed in CVS, attributes.c, revision 1.43