Hi,
In the API reference section of xmlIOParseDTD (xmlSAXHandlerPtr
sax, there
is note saying - @input will be freed by the function in any case
But when I went through the SourceCode of the version 2.6.23, I found that it
is not getting freed in all the cases. For example – 1) ctxt
= xmlNewParserCtxt(); if
(ctxt == NULL) { return(NULL); }
- It directly returns NULL without freeing the input 2) pinput
= xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
if (pinput == NULL) {
if (sax != NULL) ctxt->sax = NULL; xmlFreeParserCtxt(ctxt); return(NULL);
} – For failure within the function – xmlNewIOInputStream(), if xmlNewInputStream()
fails There can be a
potential memleak while using the API xmlIOParseDTD(). And - Even the
caller of xmlIOParseDTD() cannot take a decision to free input. Because in some
cases it gets freed, especially the success case and erratic DTD buffer case. Freeing the
input in all the cases within the function xmlIOParseDTD() needs to be done. I am
using this API. How should I deal with this situation? Thanks &
Regds., Jaya Kumar |