-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2
-
Linux (Ubuntu 8.04), 32-bit, x86.
-
27a24f1d009741b6e712300e7bc58b7e7e7d4c0b
Valgrind reports a memory leak in QXmlSchema with the following simple program:
/*schema_test.cpp*/ #include <QtCore/QCoreApplication> #include <QXmlSchema> #include <QFile> int main(int argc, char *argv[]) { if (argc < 2) return 2; QCoreApplication app(argc, argv); QFile file(argv[1]); if (!file.open(QIODevice::ReadOnly)) return 3; QXmlSchema schema; return !(schema.load(&file) && schema.isValid()); }
valgrind --tool=memcheck --leak-check=full --leak-resolution=high ./schema_test single.xsd 2> log.txt
log.txt:
==24606== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 39 from 1) ==24606== malloc/free: in use at exit: 102,378 bytes in 3,511 blocks. ==24606== malloc/free: 92,098 allocs, 88,587 frees, 4,627,966 bytes allocated. ==24606== For counts of detected errors, rerun with: -v ==24606== searching for pointers to 3,511 not-freed blocks. ==24606== checked 375,764 bytes. ... ==24606== 90,348 (60 direct, 90,288 indirect) bytes in 1 blocks are definitely lost in loss record 96 of 163 ==24606== at 0x4023294: operator new(unsigned) (vg_replace_malloc.c:224) ==24606== by 0x42C27EE: QPatternist::XsdSchemaParser::parseGlobalElement() (qxsdschemaparser.cpp:4440) ==24606== by 0x42CAA63: QPatternist::XsdSchemaParser::parseSchema(QPatternist::XsdSchemaParser::ParserType) (qxsdschemaparser.cpp:545) ==24606== by 0x42CCFFB: QPatternist::XsdSchemaParser::parse(QPatternist::XsdSchemaParser::ParserType) (qxsdschemaparser.cpp:324) ==24606== by 0x409B0A2: QXmlSchemaPrivate::load(QIODevice*, QUrl const&, QString const&) (qxmlschema_p.cpp:143) ==24606== by 0x4099A9E: QXmlSchema::load(QIODevice*, QUrl const&) (qxmlschema.cpp:145) ==24606== by 0x8048C37: main (main.cpp:18) ... ==24606== LEAK SUMMARY: ==24606== definitely lost: 1,212 bytes in 49 blocks. ==24606== indirectly lost: 90,416 bytes in 3,288 blocks. ==24606== possibly lost: 744 bytes in 3 blocks. ==24606== still reachable: 10,006 bytes in 171 blocks. ==24606== suppressed: 0 bytes in 0 blocks.