From: thierry <thi...@di...> - 2003-04-23 15:58:11
|
I have encountered a memory leak (not signalized by Purify) in the class = SaxParser. in the function parse() : "_context->sax =3D & _sax_handler; [..] release_underlying();" is not valid. structure allocated in xmlCreateMemoryParserCtxt for the = sax handler is never released due to=20 "_context->sax =3D 0 " in release_underlying(). The solution I have found was to use memcpy and to really release sax = object of context. I don't how to make patch so this is how looks my corrections in parse void SaxParser::parse(){ if(!_context) throw internal_error("Parse context not created."); //_context->sax =3D & _sax_handler; memcpy(_context->sax, &_sax_handler, sizeof(xmlSAXHandler)); _context->userData =3D this; initialize_context(); xmlParseDocument(_context); if( (! _context->wellFormed) && (! _exception) ) _exception =3D new parse_error("Document not well-formed"); //release_underlying(); xmlFreeParserCtxt(_context); _context =3D 0; check_for_exception(); } best regards Thierry Blanchard |