Always free the curren token at the end of HandleToken. bug 408939, r=bzbarsky sr=jst

This commit is contained in:
mrbkap@gmail.com 2007-12-24 11:30:36 -08:00
parent d6945425b5
commit f9fb5b564c

View File

@ -742,12 +742,11 @@ CNavDTD::HandleToken(CToken* aToken, nsIParser* aParser)
break;
}
if (NS_SUCCEEDED(result) || NS_ERROR_HTMLPARSER_BLOCK == result) {
IF_FREE(theToken, mTokenAllocator);
} else if (result == NS_ERROR_HTMLPARSER_STOPPARSING) {
IF_FREE(theToken, mTokenAllocator);
if (result == NS_ERROR_HTMLPARSER_STOPPARSING) {
mFlags |= NS_DTD_FLAG_STOP_PARSING;
} else {
return NS_OK;
} else if (NS_FAILED(result) && result != NS_ERROR_HTMLPARSER_BLOCK) {
result = NS_OK;
}
}
@ -2016,12 +2015,6 @@ CNavDTD::HandleDocTypeDeclToken(CToken* aToken)
IF_FREE(theNode, &mNodeAllocator);
// Hack for bug 395846, if we failed to add the node for whatever reason,
// then we need to free the token ourselves.
if (NS_FAILED(result) && result != NS_ERROR_HTMLPARSER_BLOCK) {
IF_FREE(aToken, mTokenAllocator);
}
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
START_TIMER();