Re: [xml] Memory leak / cleanup missing after node creation.



On 24/05/04 17:59, Jose Commins wrote:

    By the way,

                    newNode = xmlNewText(theTagReplacements[1]);
                    xmlReplaceNode(cur_node, newNode);

It still looks like a list of 'newNode's still has to be created and freed with 'xmlFreeNode' after 'xmlFreeDoc' is called; despite being assigned to the doc, xmlFreeDoc doesn't seem to remove the allocations for those 'newNode' s.

That's probably because a new text node should be created in the context of the document. Try

  newNode = xmlNewDocText(cur_node->doc, theTagReplacements[1]);

That should pepper it to fit most tastes.

Ciao,
Igor



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