Fix memory leak 13641: don't allocate a new CAttributeToken unless we're going to pass it to AddAttribute

git-svn-id: svn://10.0.0.236/trunk@47156 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
1999-09-13 20:26:14 +00:00
parent 690f592641
commit bcaf5ec635
2 changed files with 18 additions and 12 deletions

View File

@@ -624,15 +624,18 @@ nsresult nsXIFDTD::HandleTextToken(CToken* aToken) {
void nsXIFDTD::AddAttribute(nsIParserNode& aNode) {
nsString key;
nsString value;
PRBool hasValue;
hasValue = GetAttributePair(aNode,key,value);
CAttributeToken* attribute = new CAttributeToken(key,value);
nsIParserNode* top = PeekNode();
if (top != nsnull)
{
nsString key;
nsString value;
PRBool hasValue;
hasValue = GetAttributePair(aNode,key,value);
// XXX should we still be calling AddAttribute if hasValue is false?
CAttributeToken* attribute = new CAttributeToken(key,value);
((nsCParserNode*)top)->AddAttribute(attribute);
}
}