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

Dan Clusin dclusin at enernoc.com
Mon Jul 23 12:59:33 CEST 2007


I'm fairly sure that is not the issue, however I will investigate
further.
That doesn't seem to be the case because the variable for the
conditional
Surrounding the restarting of the parser is only set to true once SSL
setup
Has been completed. It is set to false at the beginning of the progam
(main) and is currently only single threaded.

Would XML_ParserReset destroy all of the state currently associated with
the
Current XML document? That's really all I'm looking for. I don't really
care
If the parser is actually destroyed and re-initialised. So long as no
data
>From the previous XML document could potentially futs up the current
document being parsed.

Regards,
Dan

-----Original Message-----
From: Sebastian Pipping [mailto:webmaster at hartwork.org] 
Sent: Sunday, July 22, 2007 11:50 AM
To: Dan Clusin
Cc: expat-discuss at libexpat.org
Subject: Re: [Expat-discuss] Heap corruption after successive
XML_ParserFree/XML_ParserCreate calls

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