Re: [xml] xmlParserCtxt Leak?



Michael Tremel wrote:
I've made the changes you've suggested,
but the same results from Valgrind keep showing up. Even after adding
xmlParserCleanup(), there are 10 allocs and 9 frees leaving 84 bytes
"still reachable". I

int main()
{
    xmlParserCtxtPtr ctxt = xmlNewParserCtxt();

You should first initialize the library, using the LIBXML_TEST_VERSION
macro. Still don't forget to add xmlCleanupParser() at the very end:


#include <libxml/parser.h>

int main()
{
    xmlParserCtxtPtr ctxt;

    LIBXML_TEST_VERSION;

    ctxt = xmlNewParserCtxt();
    xmlInitParserCtxt(ctxt);

    xmlFreeParserCtxt(ctxt);

    xmlCleanupParser();

    return 0;
}


I suggest you should look at the examples too:
http://www.xmlsoft.org/examples/index.html


Cheers, Andy



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