Re: [xml] Possible memory leak in extension functions
- From: Matt Sergeant <matt sergeant org>
- To: Daniel Veillard <veillard redhat com>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] Possible memory leak in extension functions
- Date: Tue, 18 Feb 2003 17:40:26 +0000 (GMT)
On Tue, 18 Feb 2003, Matt Sergeant wrote:
On Tue, 18 Feb 2003, Daniel Veillard wrote:
if, on an XPATH_NODESET object you set obj->boolval to 1, then
assuming also that you have groupped the nodes built for that nodeset
back into a container node, then setting obj->user to that tree will
in effect free up the whole tree when the nodeset is deallocated.
Unfortunately I have no idea what you mean when you say "groupped the
nodes ...". Do you have a API I can look at?
Never mind - I figured it out. Final code is now:
ret = xmlXPathNewNodeSet(NULL);
ret->boolval = 1;
array_result = (AV*)SvRV(perl_result);
while (av_len(array_result) >= 0) {
tmp_node1 =
(xmlNodePtr)x_PmmSvNode(sv_2mortal(av_shift(array_result)));
tmp_node = xmlDocCopyNode(tmp_node1, ctxt->context->doc,
1);
xmlXPathNodeSetAdd(ret->nodesetval, tmp_node);
if (ret->user == NULL) {
ret->user = (void*)tmp_node;
}
else {
xmlNodePtr old = (xmlNodePtr)(ret->user);
old->prev = tmp_node;
tmp_node->next = old;
ret->user = (void*)tmp_node;
}
}
valuePush(ret);
--
<!-- Matt -->
<:->get a SMart net</:->
Spam trap - do not mail: spam-sig spamtrap messagelabs com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]