fixed bug 12459 -- cannot use delete for error recovery instead should use AddRef() and Release()

This commit is contained in:
jefft%netscape.com 1999-09-11 01:44:16 +00:00
Родитель 54abb91f5f
Коммит 47859e0b68
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -590,10 +590,15 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
}
NS_ADDREF(mURL);
// *** bug 12459 - bad web page url causes system to crash
// *** jefft -- We cannot use delete if FireURLRequest() failed. The reason
// someone in the food chain could destroy the object through AddRef() &
// Release(). We should use AddRef() and Release() for error recovery too.
NS_ADDREF(mFetcher);
status = mFetcher->FireURLRequest(mURL, mOutFile, FetcherURLDoneCallback, this);
if (NS_FAILED(status))
{
delete mFetcher;
NS_RELEASE(mFetcher);
mFetcher = nsnull;
return NS_ERROR_UNEXPECTED;
}