Some memory leak fixes

This commit is contained in:
spider%netscape.com 1998-10-08 02:21:26 +00:00
parent b86cf5a78d
commit f01f44d8c6
4 changed files with 15 additions and 3 deletions

View File

@ -254,6 +254,9 @@ nsresult nsCalSessionMgr::Find(CAPISession s, int iStart, int* piFound)
*/
nsCalSession* nsCalSessionMgr::GetAt(int i)
{
if (m_List.GetSize() == 0)
return nsnull;
return (nsCalSession*) m_List.GetAt(i);
}

View File

@ -118,6 +118,8 @@ nsresult nsCalendarUser::Init()
if (NS_OK == res)
mpLayer->Init();
NS_RELEASE(supports);
return res;
}
@ -131,7 +133,9 @@ NS_IMETHODIMP nsCalendarUser :: GetLayer(nsILayer *& aLayer)
NS_IMETHODIMP nsCalendarUser :: SetLayer(nsILayer* aLayer)
{
NS_IF_RELEASE(mpLayer);
mpLayer = aLayer;
NS_ADDREF(mpLayer);
return NS_OK;
}

View File

@ -604,6 +604,7 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec,
pLayer->Init();
pLayer->SetCurl(theURL.GetCurl());
caluser->SetLayer(pLayer);
NS_RELEASE(pLayer);
/*
@ -630,6 +631,7 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec,
pLayer->SetShell(shell);
pLayer->FetchEventsByRange(&d,&d1,&EventList);
pCalendar->addEventList(&EventList);
NS_RELEASE(pLayer);
}
break;

View File

@ -134,16 +134,19 @@ nsCalendarShell::nsCalendarShell()
nsCalendarShell::~nsCalendarShell()
{
mSessionMgr.GetAt(0L)->mCapi->CAPI_DestroyHandles(mCAPISession, &mCAPIHandle, 1, 0L);
nsCalSession * session = mSessionMgr.GetAt(0L);
if (session != nsnull)
session->mCapi->CAPI_DestroyHandles(mCAPISession, &mCAPIHandle, 1, 0L);
Logoff();
NS_IF_RELEASE(mObserverManager);
if (mCAPIPassword)
PR_Free(mCAPIPassword);
if (mpLoggedInUser)
delete mpLoggedInUser;
NS_IF_RELEASE(mpLoggedInUser);
NS_IF_RELEASE(mDocumentContainer);
NS_IF_RELEASE(mShellInstance);
NS_IF_RELEASE(mCommandServer);