Re: [xml] use of xmlXPathFreeNodeSet ?
- From: "Sagaert Johan" <sagaert johan skynet be>
- To: <veillard redhat com>
- Cc: xml gnome org
- Subject: Re: [xml] use of xmlXPathFreeNodeSet ?
- Date: Tue, 18 Jun 2013 17:38:44 +0200
Hi
Thanks !
I now use xmlXPathFreeObject on the result instead of freenodeset on the nodeset member and the leak seems to
be solved.
Unfortunately I did not have valgrind for my platform so It took some time to figure out where the leak was.
Kind Regards
Johan
-----Oorspronkelijk bericht-----
Van: Daniel Veillard [mailto:veillard redhat com]
Verzonden: dinsdag 18 juni 2013 15:43
Aan: rbondue ext orange com
CC: Sagaert Johan; xml gnome org
Onderwerp: Re: [xml] use of xmlXPathFreeNodeSet ?
On Tue, Jun 18, 2013 at 09:56:42AM +0200, rbondue ext orange com wrote:
Hello,
I have run an xpath search on an xmldocument.
Afterwards I call xmlXPathFreeContext and xmlXPathFreeNodeSet to release resources.
Should I call xmlfree on the nodes found in this nodeset before I use xmlXPathFreeNodeSet ?
I really don't think you need to delete the nodes yourself.
I don't know the context of your program, but I never had to use xmlXPathFreeNodeSet(), and instead relied
on
xmlXPathFreeObject(). Last time I ran Valgrind on my program, everything seemed ok.
Confirmed, the nodeset is one part of the full object. Just free the XPath returned object.
You don't have to free the nodes pointed (but you will have to free the document at the end of processing).
In general the nodeset
just points to nodes in the document (small exception is namespace nodes but that's taken care by freeing the
object).
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ |
virtualization library
http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]