Bug 414482. Don't leak by double-addreffing in CEnumFormatEtc::Clone. Also, fix nsDataObj refcnt logging so we don't appear to be leaking those. r=jmathies,sr=jonas

This commit is contained in:
roc+@cs.cmu.edu 2008-02-06 20:07:15 -08:00
parent f612b67c34
commit 614b93d61c
2 changed files with 4 additions and 7 deletions

View File

@ -293,6 +293,7 @@ STDMETHODIMP CEnumFormatEtc::Reset(void)
*
* Purpose:
* Returns another IEnumFORMATETC with the same state as ourselves.
* It is addrefed.
*
* Parameters:
* ppEnum LPENUMFORMATETC * in which to return the

View File

@ -435,8 +435,9 @@ STDMETHODIMP_(ULONG) nsDataObj::Release()
if (0 < g_cRef)
--g_cRef;
--m_cRef;
NS_LOG_RELEASE(this, m_cRef, "nsDataObj");
if (0 != --m_cRef)
if (0 != m_cRef)
return m_cRef;
delete this;
@ -754,16 +755,11 @@ STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum)
break;
} // switch
// Since a new one has been created,
// we will ref count the new clone here
// before giving it back
if (NULL == *ppEnum)
return ResultFromScode(E_FAIL);
else
(*ppEnum)->AddRef();
// Clone already AddRefed the result so don't addref it again.
return NOERROR;
}
//-----------------------------------------------------