From f1dbababbb255f6182e3eb25f95a48b4df550a4a Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 7 Mar 2011 12:21:26 +0800 Subject: Fix a memory leak with xsl:number Pointed out by Ralf Junker , and added his reproducer to the regression tests --- libxslt/preproc.c | 4 ++++ tests/docs/bug-172.xml | 6 ++++++ tests/general/Makefile.am | 1 + tests/general/bug-172.out | 6 ++++++ tests/general/bug-172.xsl | 22 ++++++++++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 tests/docs/bug-172.xml create mode 100644 tests/general/bug-172.out create mode 100644 tests/general/bug-172.xsl diff --git a/libxslt/preproc.c b/libxslt/preproc.c index 4a4bfbfd..11500c94 100644 --- a/libxslt/preproc.c +++ b/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 diff --git a/tests/docs/bug-172.xml b/tests/docs/bug-172.xml new file mode 100644 index 00000000..406f40d1 --- /dev/null +++ b/tests/docs/bug-172.xml @@ -0,0 +1,6 @@ + +A first paragraph +A second paragraph +A third paragraph +A fourth paragraph + \ No newline at end of file diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am index 8f32fe7f..72d649b5 100644 --- a/tests/general/Makefile.am +++ b/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 \ diff --git a/tests/general/bug-172.out b/tests/general/bug-172.out new file mode 100644 index 00000000..00dd75b9 --- /dev/null +++ b/tests/general/bug-172.out @@ -0,0 +1,6 @@ + +

1. A first paragraph

+

2. A second paragraph

+

3. A third paragraph

+

4. A fourth paragraph

+ diff --git a/tests/general/bug-172.xsl b/tests/general/bug-172.xsl new file mode 100644 index 00000000..07984f59 --- /dev/null +++ b/tests/general/bug-172.xsl @@ -0,0 +1,22 @@ + + + + + + +

+
+ +

+
+
+ +
+ + + + + + + +
\ No newline at end of file -- cgit v1.2.1