[xml] xmlFreeNs bug?



hi all, hi Daniel,

I've got a problem with xmlFreeNs (). I've the following code for building a
new XMLdocument:

--- snip ------------------------
xmlDocPtr       pxDoc;
xmlNsPtr        pxNS;

pxDoc = xmlNewDoc ("1.0");
pxDoc->children = xmlNewDocNode (pxDoc, 0, "Dummy", 0);

pxNS = xmlNewNs (pxDoc->children, "uri://test", "testprfx");

xmlFreeNs (pxNS);
xmlFreeDoc (pxDoc);

--- snip ------------------------

This source brings up a memfault (core dump). I resolved, that xmlFreeNs ()
doesn't clean the docPtr. If I reverse the freeing calls, it'll also crash.
I think in this case the xmlFreeDoc () call will free also the memory for
the namespace, so xmlFreeNs () wants to free the always freed memory of
pxNS.

I am right? Is there a solution?

Does xmlFreeDoc () a cleanup of all it's elements (children, props and so
on)? Or do I have to do anything manually?

Greetings

Marcel






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