I found a small memory leak in xmlSAXParseMemory. It calls xmlCreateMemoryParserCtxt, which calls xmlNewParserCtxt, which then calls xmlInitParserCtxt, which finally calls xmlMalloc for a new xmlSAXHandler. If a xmlSAXHandler pointer is given to xmlSAXParseMemory, the one allocated in xmlInitParserCtxt will be leaked. The attached patch (ctxt-sax.patch) contains a fix. I also noticed that there is no xmlSAXParseMemoryWithData function. The second attached patch (withdata.patch) implements one and changes xmlSAXParseMemory so that it is implemented in terms of xmlSAXParseMemoryWithData. Both patches are against parser.c revision 1.225 and parser.h revision 1.79. Let me know if you have any questions. -- Peter Jones, xmlwrapp Senior Developer http://pmade.org/pjones/software/xmlwrapp/
Attachment:
ctxt-sax.patch
Description: Text document
Attachment:
withdata.patch
Description: Text document