diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp
index 17a5db06c18c..3006c839eddd 100644
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -3168,8 +3168,8 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
// Create content object
nsAutoString tag("BASE");
- nsIHTMLContent* element = nsnull;
- result = NS_CreateHTMLElement(&element, tag);
+ nsCOMPtr element;
+ result = NS_CreateHTMLElement(getter_AddRefs(element), tag);
if (NS_SUCCEEDED(result)) {
element->SetContentID(mContentIDCounter++);
diff --git a/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp
index 17a5db06c18c..3006c839eddd 100644
--- a/layout/html/document/src/nsHTMLContentSink.cpp
+++ b/layout/html/document/src/nsHTMLContentSink.cpp
@@ -3168,8 +3168,8 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
// Create content object
nsAutoString tag("BASE");
- nsIHTMLContent* element = nsnull;
- result = NS_CreateHTMLElement(&element, tag);
+ nsCOMPtr element;
+ result = NS_CreateHTMLElement(getter_AddRefs(element), tag);
if (NS_SUCCEEDED(result)) {
element->SetContentID(mContentIDCounter++);