[xml/sgml-pkgs] suspected memory leak in libxml2

martin nylin martin.nylin at gmail.com
Sat Sep 22 11:12:27 UTC 2012


hi

i'm writing an application which uses verbiste, which relies on
libxml2. when i'm running valgrind on my application i get a lot of
warning about this kind of leaks:

==15057== 68,848 bytes in 7,013 blocks are definitely lost in loss
record 114 of 114
==15057==    at 0x4C2A26B: malloc (vg_replace_malloc.c:270)
==15057==    by 0x64CF905: xmlStrndup (in
/usr/lib/x86_64-linux-gnu/libxml2.so.2.8.0)
==15057==    by 0x64772D7: xmlNodeListGetString (in
/usr/lib/x86_64-linux-gnu/libxml2.so.2.8.0)
==15057==    by 0x52732B7:
verbiste::FrenchVerbDictionary::getUTF8XmlNodeText(_xmlDoc*,
_xmlNode*) (in /usr/lib/libverbiste-0.1.so.0.0.0)
==15057==    by 0x527502E:
verbiste::FrenchVerbDictionary::readVerbs(_xmlDoc*, bool) (in
/usr/lib/libverbiste-0.1.so.0.0.0)
==15057==    by 0x5276138:
verbiste::FrenchVerbDictionary::loadVerbDatabase(char const*, bool)
(in /usr/lib/libverbiste-0.1.so.0.0.0)
==15057==    by 0x527870C:
verbiste::FrenchVerbDictionary::init(std::string const&, std::string
const&, bool) (in /usr/lib/libverbiste-0.1.so.0.0.0)
==15057==    by 0x527932E:
verbiste::FrenchVerbDictionary::FrenchVerbDictionary(std::string
const&, std::string const&, bool,
verbiste::FrenchVerbDictionary::Language) (in
/usr/lib/libverbiste-0.1.so.0.0.0)

i'm not an expert in interpreting valgrind output, but my feeling is
that the leak is in the xmlStrndup function or maybe in
xmlNodeListGetString. i have read these function but fail to
understand exactly where the leak is. is this enough info for sending
in a bug report or could it still be that the leak is in the usage of
libxml2, ie verbiste?

i'm on debian sid  amd64 as you can see from the valgrind output

regards
martin



More information about the debian-xml-sgml-pkgs mailing list