[xml] Memory leak in xmlSAXParseMemory

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

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

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

Attachment: ctxt-sax.patch
Description: Text document

Attachment: withdata.patch
Description: Text document

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