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

YunQiang Su wzssyqa at gmail.com
Sun Sep 23 13:49:50 UTC 2012


---------- Forwarded message ----------
From: Daniel Veillard <veillard at gmail.com>
Date: Sun, Sep 23, 2012 at 9:43 PM
Subject: Re: [xml/sgml-pkgs] suspected memory leak in libxml2
To: YunQiang Su <wzssyqa at gmail.com>


You're using a function which returns a string from libxml2. You never
free that string.
The bug is in the caller, not in the library.

Daniel

On Sun, Sep 23, 2012 at 9:28 PM, YunQiang Su <wzssyqa at gmail.com> wrote:
> Forwarded to upstream author
>
>
> ---------- Forwarded message ----------
> From: martin nylin <martin.nylin at gmail.com>
> Date: Sat, Sep 22, 2012 at 7:12 PM
> Subject: [xml/sgml-pkgs] suspected memory leak in libxml2
> To: debian-xml-sgml-pkgs at lists.alioth.debian.org
>
>
> 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
>
> _______________________________________________
> debian-xml-sgml-pkgs mailing list
> debian-xml-sgml-pkgs at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-xml-sgml-pkgs
>
>
> --
> YunQiang Su


-- 
YunQiang Su



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