Re: [xml] How to free memory allocated with xmlNewDocFragment() ?



* Alexandre Gouraud wrote:
I am working on gdome2 in cygwin. The test suite fail. I am stuck in the
debug somewhere with an invalid xmlFree() on a pointer allocated with
xmlNewDocFragment().

The libxml2 doc
(http://xmlsoft.org/html/libxml-tree.html#xmlNewDocFragment) does
not says what should be used to de-allocate memory allocated by
xmlNewDocFragment(). Is xmlFree() the appropriate function to use in that
case ?

A DocumentFragment is a Node so xmlFreeNode would seem the right method.
As I recall, xmlFree() ~ free(), so it would not care about memory the
Node holds, if any. The result however would seem to be a leak, not an
invalid deallocation, unless libxml2 does not use xmlFree()-able memory
for the Node. Has the DocumentFragment been added to some other node?
-- 
Björn Höhrmann · mailto:bjoern hoehrmann de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]