Re: [xml] Memory leak in xmlSAXParseMemory

On Mon, Nov 11, 2002 at 08:42:29PM -0800, Peter Jones wrote:
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.

  Hum, okay, a long time ago the sax field was filled with a reference
with the default SAX table instead of a copy, that may explain how this
leak appeared.

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

  Okay, applied too,



Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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