[xml] [htmlParser] The right way to free a htmlParserCtxtPtr


I am wondering what is the most effective to free a htmlParserCtxtPtr.
For the moment I do the following:

htmlParserCtxtPtr ctxt = NULL;

ctxt = htmlCreateMemoryParserCtxt (buffer, strlen (buffer));
htmlParseDocument (ctxt);

htmlFreeParserCtxt (ctxt);

But browing the libxml2 source code I saw that there is a "htmlCtxtReset
()" that seems to really freeing all stuff (including "ctxt->myDoc").
Should I call this function just before calling "htmlFreeParserCtxt ()"?



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