fix three backend mailnews memory leaks, r/a=sspitzer, sr=mscott 228561

This commit is contained in:
bienvenu%nventure.com 2003-12-15 23:16:03 +00:00
Родитель 7dc0e571ec
Коммит 1ec41a45c7
3 изменённых файлов: 7 добавлений и 0 удалений

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

@ -348,6 +348,7 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
{ {
nsXPIDLCString folderCharset; nsXPIDLCString folderCharset;
folder->GetCharset(getter_Copies(folderCharset)); folder->GetCharset(getter_Copies(folderCharset));
PR_Free(*dstCharset);
*dstCharset = ToNewUnicode(folderCharset); *dstCharset = ToNewUnicode(folderCharset);
} }
} }
@ -359,7 +360,10 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
// was undefined or unavailable.) // was undefined or unavailable.)
// ### well, it's not really anymore. Is there an equivalent? // ### well, it's not really anymore. Is there an equivalent?
if (!nsCRT::strcmp(*dstCharset, m_defaultCharset.get())) if (!nsCRT::strcmp(*dstCharset, m_defaultCharset.get()))
{
PR_Free(*dstCharset);
*dstCharset = nsCRT::strdup(*srcCharset); *dstCharset = nsCRT::strdup(*srcCharset);
}
if (m_forceAsciiSearch) if (m_forceAsciiSearch)
{ {
@ -370,6 +374,7 @@ nsMsgSearchAdapter::GetSearchCharsets(PRUnichar **srcCharset, PRUnichar **dstCha
// If the dest csid is ISO Latin 1 or MacRoman, attempt to convert the // If the dest csid is ISO Latin 1 or MacRoman, attempt to convert the
// source text to US-ASCII. (Not for now.) // source text to US-ASCII. (Not for now.)
// if ((dst_csid == CS_LATIN1) || (dst_csid == CS_MAC_ROMAN)) // if ((dst_csid == CS_LATIN1) || (dst_csid == CS_MAC_ROMAN))
PR_Free(*dstCharset);
*dstCharset = nsCRT::strdup(NS_LITERAL_STRING("us-ascii").get()); *dstCharset = nsCRT::strdup(NS_LITERAL_STRING("us-ascii").get());
} }
return NS_OK; return NS_OK;

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

@ -607,6 +607,7 @@ nsMsgIdentity::getFolderPref(const char *prefname, char **retval, PRBool mustHav
{ {
nsCOMPtr <nsIMsgFolder> msgFolder; nsCOMPtr <nsIMsgFolder> msgFolder;
rv = server->GetMsgFolderFromURI(folderResource, *retval, getter_AddRefs(msgFolder)); rv = server->GetMsgFolderFromURI(folderResource, *retval, getter_AddRefs(msgFolder));
PR_Free(*retval);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
return msgFolder->GetURI(retval); return msgFolder->GetURI(retval);
} }

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

@ -5456,6 +5456,7 @@ void nsImapProtocol::OnStatusForFolder(const char *mailboxName)
nsImapMailboxSpec *new_spec = GetServerStateParser().CreateCurrentMailboxSpec(mailboxName); nsImapMailboxSpec *new_spec = GetServerStateParser().CreateCurrentMailboxSpec(mailboxName);
if (new_spec && m_imapMailFolderSink) if (new_spec && m_imapMailFolderSink)
m_imapMailFolderSink->UpdateImapMailboxStatus(this, new_spec); m_imapMailFolderSink->UpdateImapMailboxStatus(this, new_spec);
NS_IF_RELEASE(new_spec);
} }