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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user