GNOME Bugzilla – Bug 615767
Memory leak with empty in interleave
Last modified: 2021-07-05 13:24:16 UTC
Parsing and then freeing the following grammar: <element xmlns='http://relaxng.org/ns/structure/1.0' name='test'><interleave><empty/></interleave></element> with libxml2-2.7.7 results in a Valgrind leak report of: 12,344 (32 direct, 12,312 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 at 0x4C2404C: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4F64F8E: xmlRelaxNGComputeInterleaves (relaxng.c:4369) by 0x4E9D33A: stubHashScannerFull (hash.c:801) by 0x4E9D469: xmlHashScanFull (hash.c:848) by 0x4E9D374: xmlHashScan (hash.c:817) by 0x4F6C36B: xmlRelaxNGParse (relaxng.c:7543) This is the line "partitions = (xmlRelaxNGPartitionPtr) xmlMalloc(sizeof(xmlRelaxNGPartition));". It looks like xmlRelaxNGFreePartition never gets called. No leak is reported if the <empty/> is replaced with e.g. <text/>.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.