Fixed atom memory leaks and HTMLAttribute memory leaks (for unmapped attrs only)

This commit is contained in:
kipp%netscape.com 1999-09-30 21:17:06 +00:00
Родитель 9bd06a46ad
Коммит da75f9061f
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -1413,6 +1413,11 @@ HTMLAttributesImpl::GetMappedAttributeStyleRules(nsISupportsArray* aArray) const
NS_IMETHODIMP NS_IMETHODIMP
HTMLAttributesImpl::Reset(void) 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) { if (mAttrNames != mNameBuffer) {
delete [] mAttrNames; delete [] mAttrNames;
mAttrNames = mNameBuffer; mAttrNames = mNameBuffer;
@ -1421,7 +1426,7 @@ HTMLAttributesImpl::Reset(void)
mAttrCount = 0; mAttrCount = 0;
if (mFirstUnmapped) { if (mFirstUnmapped) {
delete mFirstUnmapped; HTMLAttribute::DeleteHTMLAttributes(mFirstUnmapped);
} }
if (mMapped) { if (mMapped) {

Просмотреть файл

@ -1413,6 +1413,11 @@ HTMLAttributesImpl::GetMappedAttributeStyleRules(nsISupportsArray* aArray) const
NS_IMETHODIMP NS_IMETHODIMP
HTMLAttributesImpl::Reset(void) 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) { if (mAttrNames != mNameBuffer) {
delete [] mAttrNames; delete [] mAttrNames;
mAttrNames = mNameBuffer; mAttrNames = mNameBuffer;
@ -1421,7 +1426,7 @@ HTMLAttributesImpl::Reset(void)
mAttrCount = 0; mAttrCount = 0;
if (mFirstUnmapped) { if (mFirstUnmapped) {
delete mFirstUnmapped; HTMLAttribute::DeleteHTMLAttributes(mFirstUnmapped);
} }
if (mMapped) { if (mMapped) {