[Expat-discuss] Heap corruption after successive XML_ParserFree/XML_ParserCreate calls

Sebastian Pipping webmaster at hartwork.org
Sun Jul 22 17:49:30 CEST 2007


Dan Clusin wrote:
> printf("restarting parser.\n");
>
> //xml_parser_destroy( the_session );
>
> xml_parser_init( the_session );

-------------------------------------------------
Hello Dan!


I was wonderung if you also call the destroy
method the very first time with no parser
instance existing yet. Since XML_Parser
is a pointer type

   typedef struct XML_ParserStruct *XML_Parser;

a call to xml_parser_destroy on a session
with an uninitialized XML_Parser member would
call free() on a broken pointer. Just an idea.

If that's not the guilty part the only other
thing I can offer you is a workaround calling
XML_ParserReset on the old parser and then
reusing it.

Good luck!



Sebastian


More information about the Expat-discuss mailing list