зеркало из https://github.com/mozilla/pjs.git
Bug #111381 --> Freeing mismatched memory in free. Patch by mikael@parknert.se
sr=bienvenu r=mscott
This commit is contained in:
Родитель
aa7825b00b
Коммит
aab34e96b4
|
@ -335,7 +335,7 @@ nsMsgKeySet::Output(char **outputStr)
|
|||
plus 10 bytes of slop. */
|
||||
PRInt32 so = s - s_head;
|
||||
s_size += 200;
|
||||
char* tmp = new char[s_size];
|
||||
char* tmp = (char *) nsMemory::Alloc(s_size);
|
||||
if (tmp) PL_strcpy(tmp, s_head);
|
||||
nsMemory::Free(s_head);
|
||||
s_head = tmp;
|
||||
|
@ -1428,7 +1428,7 @@ nsMsgKeySet::test_ranges(void)
|
|||
if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \
|
||||
printf (" %3d = %s\n", N, \
|
||||
(set->IsMember(N) ? "true" : "false")); \
|
||||
delete [] s
|
||||
nsMemory::Free(s);
|
||||
|
||||
void
|
||||
nsMsgKeySet::test_member(PRBool with_cache)
|
||||
|
|
|
@ -421,13 +421,11 @@ nsNNTPNewsgroupList::AddToKnownArticles(PRInt32 first, PRInt32 last)
|
|||
nsCOMPtr <nsIDBFolderInfo> newsGroupInfo;
|
||||
rv = m_newsDB->GetDBFolderInfo(getter_AddRefs(newsGroupInfo));
|
||||
if (NS_SUCCEEDED(rv) && newsGroupInfo) {
|
||||
char *output;
|
||||
status = m_knownArts.set->Output(&output);
|
||||
nsXPIDLCString output;
|
||||
status = m_knownArts.set->Output(getter_Copies(output));
|
||||
if (output) {
|
||||
newsGroupInfo->SetKnownArtsSet(output);
|
||||
nsMemory::Free(output);
|
||||
}
|
||||
output = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -788,15 +788,15 @@ nsMsgNewsFolder::UpdateSummaryFromNNTPInfo(PRInt32 oldest, PRInt32 youngest, PRI
|
|||
PRInt32 oldUnreadMessages = mNumUnreadMessages;
|
||||
PRInt32 oldTotalMessages = mNumTotalMessages;
|
||||
|
||||
char *setStr = nsnull;
|
||||
/* First, mark all of the articles now known to be expired as read. */
|
||||
if (oldest > 1)
|
||||
{
|
||||
nsXPIDLCString oldSet;
|
||||
nsXPIDLCString newSet;
|
||||
mReadSet->Output(getter_Copies(oldSet));
|
||||
mReadSet->AddRange(1, oldest - 1);
|
||||
rv = mReadSet->Output(&setStr);
|
||||
if (setStr && nsCRT::strcmp(setStr, oldSet))
|
||||
rv = mReadSet->Output(getter_Copies(newSet));
|
||||
if (!oldSet.Equals(newSet))
|
||||
newsrcHasChanged = PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -838,8 +838,6 @@ nsMsgNewsFolder::UpdateSummaryFromNNTPInfo(PRInt32 oldest, PRInt32 youngest, PRI
|
|||
if(oldUnreadMessages != mNumUnreadMessages)
|
||||
NotifyIntPropertyChanged(kTotalUnreadMessagesAtom, oldUnreadMessages, mNumUnreadMessages);
|
||||
|
||||
nsCRT::free(setStr);
|
||||
setStr = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1515,17 +1513,17 @@ nsMsgNewsFolder::GetNewsrcLine(char **newsrcLine)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString newsrcLineStr;
|
||||
newsrcLineStr = (const char *)newsgroupname;
|
||||
newsrcLineStr += ":";
|
||||
newsrcLineStr = newsgroupname;
|
||||
newsrcLineStr += ':';
|
||||
|
||||
nsXPIDLCString setStr;
|
||||
if (mReadSet) {
|
||||
nsXPIDLCString setStr;
|
||||
mReadSet->Output(getter_Copies(setStr));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
newsrcLineStr += " ";
|
||||
newsrcLineStr += ' ';
|
||||
newsrcLineStr += setStr;
|
||||
newsrcLineStr += MSG_LINEBREAK;
|
||||
newsrcLineStr.AppendLiteral(MSG_LINEBREAK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче