Memoryleak when using undefined function in match
Using libxslt 7d81bd62d5788a9e2931c20a3d0a6be7e703c608
, built with
git clone https://gitlab.gnome.org/GNOME/libxslt/ && cd libxslt
autoreconf -i
./configure --disable-shared --enable-static
make
valgrind --leak-check=full ./xsltproc/xsltproc input.xslt input.xml
Valgrind output
$ valgrind --leak-check=full ./xsltproc/xsltproc ~/Desktop/input.xslt ~/Desktop/input.xml ==18737== Memcheck, a memory error detector ==18737== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==18737== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==18737== Command: ./xsltproc/xsltproc /home/prakti/Desktop/input.xslt /home/prakti/Desktop/input.xml ==18737== compilation error: file /home/prakti/Desktop/input.xslt line 1 element stylesheet xsl:version: only 1.1 features are supported xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error xmlXPathCompOpEval: function foo not found XPath error : Unregistered function XPath error : Stack usage error ==18737== ==18737== HEAP SUMMARY: ==18737== in use at exit: 78,584 bytes in 46 blocks ==18737== total heap usage: 941 allocs, 895 frees, 260,451 bytes allocated ==18737== ==18737== 168 (72 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 7 ==18737== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==18737== by 0x4EE0255: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE6789: xmlXPathRoot (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EEA2A4: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9EB7: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9EB7: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9795: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EEC990: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EF239F: xmlXPathEval (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4106B5: xsltTestCompMatchDirect (pattern.c:582) ==18737== by 0x4106B5: xsltTestCompMatch (pattern.c:1161) ==18737== by 0x413117: xsltGetTemplate (pattern.c:2469) ==18737== by 0x4234A4: xsltDefaultProcessOneNode (transform.c:2061) ==18737== ==18737== 5,712 (1,008 direct, 4,704 indirect) bytes in 14 blocks are definitely lost in loss record 6 of 7 ==18737== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==18737== by 0x4EDB442: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EEB983: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9ED8: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9EB7: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EE9795: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EEC990: ??? (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4EF239F: xmlXPathEval (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3) ==18737== by 0x4106B5: xsltTestCompMatchDirect (pattern.c:582) ==18737== by 0x4106B5: xsltTestCompMatch (pattern.c:1161) ==18737== by 0x413117: xsltGetTemplate (pattern.c:2469) ==18737== by 0x4234A4: xsltDefaultProcessOneNode (transform.c:2061) ==18737== by 0x42300C: xsltProcessOneNode (transform.c:2164) ==18737== ==18737== LEAK SUMMARY: ==18737== definitely lost: 1,080 bytes in 15 blocks ==18737== indirectly lost: 4,800 bytes in 30 blocks ==18737== possibly lost: 0 bytes in 0 blocks ==18737== still reachable: 72,704 bytes in 1 blocks ==18737== suppressed: 0 bytes in 0 blocks ==18737== Reachable blocks (those to which a pointer was found) are not shown. ==18737== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==18737== ==18737== For counts of detected and suppressed errors, rerun with: -v ==18737== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Running on Ubuntu 16.04, the installed libxml2 version is 2.9.3+dfsg1-1ubuntu0.6
.
$ uname -a
Linux syssec-cip-pool-pc14 4.15.0-32-generic #35~16.04.1-Ubuntu SMP Fri Aug 10 21:54:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Running xsltproc with the attached input files leads to a 1KiB memory leak. The amount of memory leaked increases when the input xml file gets bigger.