Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a memory leak with xsl:number

Pointed out by Ralf Junker <ralfjunker@gmx.de>, and added his
reproducer to the regression tests
  • Loading branch information...
commit f1dbababbb255f6182e3eb25f95a48b4df550a4a 1 parent 4e99090
@veillard veillard authored
View
4 libxslt/preproc.c
@@ -498,6 +498,10 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) {
xsltFreeLocale(comp->locale);
if (comp->comp != NULL)
xmlXPathFreeCompExpr(comp->comp);
+ if (comp->numdata.countPat != NULL)
+ xsltFreeCompMatchList(comp->numdata.countPat);
+ if (comp->numdata.fromPat != NULL)
+ xsltFreeCompMatchList(comp->numdata.fromPat);
if (comp->nsList != NULL)
xmlFree(comp->nsList);
#endif
View
6 tests/docs/bug-172.xml
@@ -0,0 +1,6 @@
+<params>
+<para bold="true">A first paragraph</para>
+<para>A second paragraph</para>
+<para>A third paragraph</para>
+<para>A fourth paragraph</para>
+</params>
View
1  tests/general/Makefile.am
@@ -179,6 +179,7 @@ EXTRA_DIST = \
bug-169.out bug-169.xsl bug-169.imp \
bug-170.out bug-170.xsl \
bug-171.out bug-171.xsl \
+ bug-172.out bug-172.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
View
6 tests/general/bug-172.out
@@ -0,0 +1,6 @@
+<html><body>
+<p><b>1. A first paragraph</b></p>
+<p>2. A second paragraph</p>
+<p>3. A third paragraph</p>
+<p>4. A fourth paragraph</p>
+</body></html>
View
22 tests/general/bug-172.xsl
@@ -0,0 +1,22 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="para">
+
+ <xsl:choose>
+ <xsl:when test="@bold='true'">
+ <p><b><xsl:number count="para" format="1. "/> <xsl:apply-templates/></b></p>
+ </xsl:when>
+ <xsl:otherwise>
+ <p><xsl:number count="para" format="1. "/> <xsl:apply-templates/></p>
+ </xsl:otherwise>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template match="/">
+ <html><body>
+ <xsl:apply-templates/>
+ </body></html>
+</xsl:template>
+
+</xsl:stylesheet>
Please sign in to comment.
Something went wrong with that request. Please try again.