diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index e36d3fa3efc0..eb46f5e00e40 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1125,6 +1125,7 @@ SetDocumentInChildrenOf(nsIContent* aContent, nsIDocument* aDocument) aContent->ChildAt(i, child); if (nsnull != child) { child->SetDocument(aDocument, PR_TRUE); + NS_RELEASE(child); } } } diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp index e36d3fa3efc0..eb46f5e00e40 100644 --- a/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/layout/html/content/src/nsGenericHTMLElement.cpp @@ -1125,6 +1125,7 @@ SetDocumentInChildrenOf(nsIContent* aContent, nsIDocument* aDocument) aContent->ChildAt(i, child); if (nsnull != child) { child->SetDocument(aDocument, PR_TRUE); + NS_RELEASE(child); } } } diff --git a/layout/html/content/src/nsHTMLGenericContent.cpp b/layout/html/content/src/nsHTMLGenericContent.cpp index aed6318d8618..96102fa1a91a 100644 --- a/layout/html/content/src/nsHTMLGenericContent.cpp +++ b/layout/html/content/src/nsHTMLGenericContent.cpp @@ -2265,6 +2265,7 @@ SetDocumentInChildrenOf(nsIContent* aContent, nsIDocument* aDocument) if (nsnull != child) { child->SetDocument(aDocument); SetDocumentInChildrenOf(child, aDocument); + NS_RELEASE(child); } } }