[xml] libxml memory leaks



I am using libxml2-2.6.26, cross-compiled for an ARM platform.

I am seeing very severe memory leaks - on the order of 40K per invocation of xmlXPathNewContext (if I read valgrind correctly...)

I've gone through the code, and I am using

xmlFree(xpathCtx);

paired with every invocation of xmlXPathNewContext.

I can't help but think that I am doing something seriously wrong....

I am only using three functions that allocate memory in the following order:

doc = xmlReadFile("file");
xpathCtx = xmlXPathNewContext(doc);
xpathObj = xmlXPathEvalExpression("expr",xpathCtx);

Is there some special way I need to free these pointers:

I am freeing them in the following order:

xmlFree(xpathCtx);
xmlFree(xpathObj);
xmlFreeDoc(doc);

What am I missing?

(I can provide more info if someone can tell me what options to throw at valgrind...)

--Yan



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