From d3a9108ad864598486d3c4f48d8e22913ad2aa74 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Fri, 3 Dec 1999 00:33:17 +0000 Subject: [PATCH] fixed bug 20229; r=beard. Special thanks to patrick for his persistence with leaks. git-svn-id: svn://10.0.0.236/trunk@55132 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsParserNode.cpp | 13 +++++++++++-- mozilla/parser/htmlparser/src/nsParserNode.cpp | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/nsParserNode.cpp b/mozilla/htmlparser/src/nsParserNode.cpp index 4e302d98358..3d8028284f0 100644 --- a/mozilla/htmlparser/src/nsParserNode.cpp +++ b/mozilla/htmlparser/src/nsParserNode.cpp @@ -78,12 +78,21 @@ static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) { * @return */ nsCParserNode::~nsCParserNode() { - if(mRecycler && mAttributes) { - RecycleTokens(mRecycler,*mAttributes); + if(mAttributes) { + + //fixed a bug that patrick found, where the attributes deque existed + //but was empty. In that case, the attributes deque itself was leaked. + //THANKS PATRICK! + + if(mRecycler) { + RecycleTokens(mRecycler,*mAttributes); + } delete mAttributes; + mAttributes=0; } } + NS_IMPL_ADDREF(nsCParserNode) NS_IMPL_RELEASE(nsCParserNode) diff --git a/mozilla/parser/htmlparser/src/nsParserNode.cpp b/mozilla/parser/htmlparser/src/nsParserNode.cpp index 4e302d98358..3d8028284f0 100644 --- a/mozilla/parser/htmlparser/src/nsParserNode.cpp +++ b/mozilla/parser/htmlparser/src/nsParserNode.cpp @@ -78,12 +78,21 @@ static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) { * @return */ nsCParserNode::~nsCParserNode() { - if(mRecycler && mAttributes) { - RecycleTokens(mRecycler,*mAttributes); + if(mAttributes) { + + //fixed a bug that patrick found, where the attributes deque existed + //but was empty. In that case, the attributes deque itself was leaked. + //THANKS PATRICK! + + if(mRecycler) { + RecycleTokens(mRecycler,*mAttributes); + } delete mAttributes; + mAttributes=0; } } + NS_IMPL_ADDREF(nsCParserNode) NS_IMPL_RELEASE(nsCParserNode)