[xslt] XSLT memory leak - GIT 2011-02-28 01:54:15, 7f741527832



Attached files cause a memory leak in xsltproc if passed like this:

  xsltproc Tutorial.xsl Tutorial.xml

The leak happens in the library and was discovered outside xsltproc.

The attached Tutorial_Leak.log contains the stack trace leading to the leak.

I am sorry I do not provide a fix, but the leak is deeply nested and I
was not able to find the section where the memory should be freed. I am
compiling without XSLT_REFACTORED if that matters.

Can someone confirm this? Or even suggest a fix?

Thanks,

Ralf
<params>
<para bold="true">A first paragraph</para>
<para>A second paragraph</para>
<para>A third paragraph</para>
<para>A fourth paragraph</para>
</params>
<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>
Error 00001. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD092F8) was never freed

The memory block (0x00D092F8) [size: 80 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x005D0BB4(=Project1.exe:0x01:1CFBB4) xslt\libxslt\pattern.c#146
   0x005D8805(=Project1.exe:0x01:1D7805) xslt\libxslt\pattern.c#1877
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00002. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD092A0) was never freed

The memory block (0x00D092A0) [size: 80 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x005D0BB4(=Project1.exe:0x01:1CFBB4) xslt\libxslt\pattern.c#146
   0x005D8805(=Project1.exe:0x01:1D7805) xslt\libxslt\pattern.c#1877
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00003. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD3CC30) was never freed

The memory block (0x00D3CC30) [size: 76 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x004C0AF9(=Project1.exe:0x01:0BFAF9) xml\tree.c#5763
   0x005D88FA(=Project1.exe:0x01:1D78FA) xslt\libxslt\pattern.c#1893
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00004. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD3CD20) was never freed

The memory block (0x00D3CD20) [size: 76 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x004C0AF9(=Project1.exe:0x01:0BFAF9) xml\tree.c#5763
   0x005D88FA(=Project1.exe:0x01:1D78FA) xslt\libxslt\pattern.c#1893
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00005. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD003D0) was never freed

The memory block (0x00D003D0) [size: 352 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x005D0C29(=Project1.exe:0x01:1CFC29) xslt\libxslt\pattern.c#155
   0x005D8805(=Project1.exe:0x01:1D7805) xslt\libxslt\pattern.c#1877
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00006. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD00550) was never freed

The memory block (0x00D00550) [size: 352 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x005D0C29(=Project1.exe:0x01:1CFC29) xslt\libxslt\pattern.c#155
   0x005D8805(=Project1.exe:0x01:1D7805) xslt\libxslt\pattern.c#1877
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00007. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD806E0) was never freed

The memory block (0x00D806E0) [size: 37 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x0056B1F5(=Project1.exe:0x01:16A1F5) xml\xmlstring.c#45
   0x005D543C(=Project1.exe:0x01:1D443C) xslt\libxslt\pattern.c#1343
   0x005D8096(=Project1.exe:0x01:1D7096) xslt\libxslt\pattern.c#1783
   0x005D89A4(=Project1.exe:0x01:1D79A4) xslt\libxslt\pattern.c#1912
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00008. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD806B0) was never freed

The memory block (0x00D806B0) [size: 37 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x0056B1F5(=Project1.exe:0x01:16A1F5) xml\xmlstring.c#45
   0x005D886E(=Project1.exe:0x01:1D786E) xslt\libxslt\pattern.c#1888
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00009. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD80770) was never freed

The memory block (0x00D80770) [size: 37 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x0056B1F5(=Project1.exe:0x01:16A1F5) xml\xmlstring.c#45
   0x005D886E(=Project1.exe:0x01:1D786E) xslt\libxslt\pattern.c#1888
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Error 00010. 0x300010 (Thread 0x074C):
Resource leak: The memory block (0xD807A0) was never freed

The memory block (0x00D807A0) [size: 37 bytes] was allocated with malloc
| xml\xmlmemory.c line 174:
|     TEST_POINT
|
|>    p = (MEMHDR *) malloc(RESERVE_SIZE+size);
|
|     if (!p) {
Call Tree:
   0x004EE645(=Project1.exe:0x01:0ED645) xml\xmlmemory.c#174
   0x004EE9F7(=Project1.exe:0x01:0ED9F7) xml\xmlmemory.c#296
   0x0056B1F5(=Project1.exe:0x01:16A1F5) xml\xmlstring.c#45
   0x005D543C(=Project1.exe:0x01:1D443C) xslt\libxslt\pattern.c#1343
   0x005D8096(=Project1.exe:0x01:1D7096) xslt\libxslt\pattern.c#1783
   0x005D89A4(=Project1.exe:0x01:1D79A4) xslt\libxslt\pattern.c#1912
   0x005D8EF2(=Project1.exe:0x01:1D7EF2) xslt\libxslt\pattern.c#2007
   0x005DCF67(=Project1.exe:0x01:1DBF67) xslt\libxslt\preproc.c#1453
   0x005DEAB8(=Project1.exe:0x01:1DDAB8) xslt\libxslt\preproc.c#2282
   0x005F9CF6(=Project1.exe:0x01:1F8CF6) xslt\libxslt\xslt.c#3497
   0x005FC358(=Project1.exe:0x01:1FB358) xslt\libxslt\xslt.c#6420
   0x005FC686(=Project1.exe:0x01:1FB686) xslt\libxslt\xslt.c#6636
   0x005FC765(=Project1.exe:0x01:1FB765) xslt\libxslt\xslt.c#6675
   0x005AC8DE(=Project1.exe:0x01:1AB8DE) xsltproc.c#832
   0x32B9C3BA(=CC32110MT.DLL:0x01:09B3BA)

------------------------------------------
Functions called:
 delete (21 times)
 fflush (1 times)
 fwrite (2 times)
 _snprintf (1 times)
 fclose (2 times)
 memmove (61 times)
 fread (4 times)
 strncpy (2 times)
 _wfopen (2 times)
 strcmp (21 times)
 memset (967 times)
 strcpy (24 times)
 strlen (97 times)
 realloc (6 times)
 memcpy (376 times)
 free (772 times)
 new (30 times)
 calloc (10 times)
 malloc (773 times)
Resource types used:
 file stream (2 allocs, 1 max)
 file handle (2 allocs, 1 max)
 object (30 allocs, 30 max)
 memory block (784 allocs, 580 max)
==========================================


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]