diff --git a/content/html/style/src/nsHTMLAttributes.cpp b/content/html/style/src/nsHTMLAttributes.cpp index 489b311c0e5e..4874a6f5fd61 100644 --- a/content/html/style/src/nsHTMLAttributes.cpp +++ b/content/html/style/src/nsHTMLAttributes.cpp @@ -1413,6 +1413,11 @@ HTMLAttributesImpl::GetMappedAttributeStyleRules(nsISupportsArray* aArray) const NS_IMETHODIMP HTMLAttributesImpl::Reset(void) { + // Release atoms first, then the table if it was malloc'd + PRInt32 i, n = mAttrCount; + for (i = 0; i < n; i++) { + NS_IF_RELEASE(mAttrNames[i]); + } if (mAttrNames != mNameBuffer) { delete [] mAttrNames; mAttrNames = mNameBuffer; @@ -1421,7 +1426,7 @@ HTMLAttributesImpl::Reset(void) mAttrCount = 0; if (mFirstUnmapped) { - delete mFirstUnmapped; + HTMLAttribute::DeleteHTMLAttributes(mFirstUnmapped); } if (mMapped) { diff --git a/layout/html/style/src/nsHTMLAttributes.cpp b/layout/html/style/src/nsHTMLAttributes.cpp index 489b311c0e5e..4874a6f5fd61 100644 --- a/layout/html/style/src/nsHTMLAttributes.cpp +++ b/layout/html/style/src/nsHTMLAttributes.cpp @@ -1413,6 +1413,11 @@ HTMLAttributesImpl::GetMappedAttributeStyleRules(nsISupportsArray* aArray) const NS_IMETHODIMP HTMLAttributesImpl::Reset(void) { + // Release atoms first, then the table if it was malloc'd + PRInt32 i, n = mAttrCount; + for (i = 0; i < n; i++) { + NS_IF_RELEASE(mAttrNames[i]); + } if (mAttrNames != mNameBuffer) { delete [] mAttrNames; mAttrNames = mNameBuffer; @@ -1421,7 +1426,7 @@ HTMLAttributesImpl::Reset(void) mAttrCount = 0; if (mFirstUnmapped) { - delete mFirstUnmapped; + HTMLAttribute::DeleteHTMLAttributes(mFirstUnmapped); } if (mMapped) {