fix memory leaks of uri's and a progress string r=mscott

This commit is contained in:
bienvenu%netscape.com 1999-10-20 20:49:45 +00:00
Родитель a09ca1b028
Коммит cba2dfa027
2 изменённых файлов: 8 добавлений и 7 удалений

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

@ -54,6 +54,7 @@
#include "nsIPrompt.h"
#include "nsINetSupportDialogService.h"
#include "nsSpecialSystemDirectory.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID);
@ -3214,8 +3215,8 @@ nsImapMailFolder::CopyStreamMessage(nsIMessage* message,
nsCOMPtr<nsIRDFResource> messageNode(do_QueryInterface(message));
if (!messageNode) return NS_ERROR_FAILURE;
char *uri;
messageNode->GetValue(&uri);
nsXPIDLCString uri;
messageNode->GetValue(getter_Copies(uri));
if (!m_copyState->m_msgService)
{
@ -3251,10 +3252,9 @@ nsImapMailCopyState::~nsImapMailCopyState()
nsCOMPtr<nsIRDFResource> msgNode(do_QueryInterface(m_message));
if (msgNode)
{
char* uri;
msgNode->GetValue(&uri);
if (uri)
ReleaseMessageServiceFromURI(uri, m_msgService);
nsXPIDLCString uri;
msgNode->GetValue(getter_Copies(uri));
ReleaseMessageServiceFromURI(uri, m_msgService);
}
}
if (m_tmpFileSpec)

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

@ -3870,13 +3870,14 @@ nsImapProtocol::ShowProgress()
// lossy if localized string has non-8-bit chars, but we're
// stuck with PR_smprintf for now.
nsCString cProgressString(progressString);
PR_FREEIF(progressString);
const char *mailboxName = GetServerStateParser().GetSelectedMailboxName();
char *printfString = PR_smprintf(cProgressString, (mailboxName) ? mailboxName : "", ++m_progressIndex, m_progressCount);
if (printfString)
{
nsString formattedString(printfString);
PR_FREEIF(progressString);
PR_FREEIF(printfString);
progressString = nsCRT::strdup(formattedString.GetUnicode());
}