Fixed mismatched delete problem (purify).

This commit is contained in:
warren%netscape.com 1999-07-28 04:05:10 +00:00
Родитель e6ca89c1bb
Коммит 5c61055a2b
8 изменённых файлов: 20 добавлений и 30 удалений

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

@ -198,22 +198,12 @@ class nsOnStartRequestEvent : public nsStreamListenerEvent
public:
nsOnStartRequestEvent(nsAsyncStreamObserver* listener,
nsIChannel* channel, nsISupports* context)
: nsStreamListenerEvent(listener, channel, context),
mContentType(nsnull) {}
virtual ~nsOnStartRequestEvent();
: nsStreamListenerEvent(listener, channel, context) {}
virtual ~nsOnStartRequestEvent() {}
NS_IMETHOD HandleEvent();
protected:
char* mContentType;
};
nsOnStartRequestEvent::~nsOnStartRequestEvent()
{
if (mContentType)
delete[] mContentType;
}
NS_IMETHODIMP
nsOnStartRequestEvent::HandleEvent()
{

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

@ -41,8 +41,8 @@ nsSimpleURI::nsSimpleURI(nsISupports* outer)
nsSimpleURI::~nsSimpleURI()
{
if (mScheme) delete[] mScheme;
if (mPath) delete[] mPath;
if (mScheme) nsCRT::free(mScheme);
if (mPath) nsCRT::free(mPath);
}
NS_IMPL_AGGREGATED(nsSimpleURI);

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

@ -121,7 +121,7 @@ nsFileChannel::Init(nsFileProtocolHandler* handler,
rv = mURI->GetSpec(&url);
if (NS_FAILED(rv)) return rv;
nsFileURL fileURL(url);
delete [] url;
nsCRT::free(url);
mSpec = fileURL;
}
@ -622,7 +622,7 @@ nsFileChannel::GetContentType(char * *aContentType)
nsIMIMEInfo *MIMEInfo = nsnull;
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
delete [] ext;
nsAllocator::Free(ext);
if (NS_FAILED(rv)) return rv;
rv = MIMEInfo->GetMIMEType(aContentType);

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

@ -541,7 +541,7 @@ nsFtpConnectionThread::Run() {
char *p = newPath.ToNewCString();
mUrl->SetPath(p);
delete [] p;
nsAllocator::Free(p);
}
}

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

@ -241,7 +241,7 @@ nsHTTPChannel::GetContentType(char * *aContentType)
nsIMIMEInfo *MIMEInfo = nsnull;
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
delete [] ext;
nsAllocator::Free(ext);
if (NS_FAILED(rv)) {
// default to text/html
*aContentType = nsCRT::strdup(DUMMY_TYPE);

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

@ -721,7 +721,7 @@ nsresult nsHTTPResponseListener::ProcessRedirection(PRInt32 aStatusCode)
m_ResponseContext = nsnull;
}
}
delete[] location;
nsCRT::free(location);
}
}
return rv;

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

@ -291,7 +291,7 @@ nsStreamConverterService::FindConverter(const char *aProgID, nsVoidArray **aEdge
curVertexAtom->ToString(curVertexStr);
char * curVertexCString = curVertexStr.ToNewCString();
nsStringKey *curVertex = new nsStringKey(curVertexCString);
delete [] curVertexCString;
nsAllocator::Free(curVertexCString);
SCTableData *data = (SCTableData*)lBFSTable.Get(curVertex);
BFSState *curVertexState = (BFSState*)data->data;
@ -343,12 +343,12 @@ nsStreamConverterService::FindConverter(const char *aProgID, nsVoidArray **aEdge
char *from = predecessorData->keyString->ToNewCString();
newProgID->Append(from);
delete [] from;
nsAllocator::Free(from);
newProgID->Append("?to=");
char *to = data->keyString->ToNewCString();
newProgID->Append(to);
delete [] to;
nsAllocator::Free(to);
// Add this PROGID to the chain.
shortestPath->AppendElement(newProgID);
@ -389,14 +389,14 @@ nsStreamConverterService::Convert(nsIInputStream *aFromStream,
// couldn't go direct, let's try walking the graph of converters.
rv = BuildGraph();
if (NS_FAILED(rv)) {
delete [] cProgID;
nsAllocator::Free(cProgID);
return rv;
}
nsVoidArray *converterChain = nsnull;
rv = FindConverter(cProgID, &converterChain);
delete [] cProgID;
nsAllocator::Free(cProgID);
cProgID = nsnull;
if (NS_FAILED(rv)) {
// can't make this conversion.
@ -423,7 +423,7 @@ nsStreamConverterService::Convert(nsIInputStream *aFromStream,
nsString2 fromStr(eOneByte), toStr(eOneByte);
rv = ParseFromTo(lProgID, fromStr, toStr);
delete [] lProgID;
nsAllocator::Free(lProgID);
if (NS_FAILED(rv)) return rv;
nsIStreamConverter *conv = nsnull;
@ -477,14 +477,14 @@ nsStreamConverterService::AsyncConvertData(const PRUnichar *aFromType,
// couldn't go direct, let's try walking the graph of converters.
rv = BuildGraph();
if (NS_FAILED(rv)) {
delete [] cProgID;
nsAllocator::Free(cProgID);
return rv;
}
nsVoidArray *converterChain = nsnull;
rv = FindConverter(cProgID, &converterChain);
delete [] cProgID;
nsAllocator::Free(cProgID);
cProgID = nsnull;
if (NS_FAILED(rv)) {
// can't make this conversion.
@ -511,7 +511,7 @@ nsStreamConverterService::AsyncConvertData(const PRUnichar *aFromType,
nsString2 fromStr(eOneByte), toStr(eOneByte);
rv = ParseFromTo(lProgID, fromStr, toStr);
delete [] lProgID;
nsAllocator::Free(lProgID);
if (NS_FAILED(rv)) return rv;
nsIStreamConverter *conv = nsnull;

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

@ -143,7 +143,7 @@ NS_IMETHODIMP TestConsumer::OnStopRequest(nsISupports *context, nsIChannel* chan
mUrl->ToNewCString(&url);
printf("Unable to load URL %s\n", url);
delete [] url;
nsAllocator::Free(url);
}
urlLoaded = 1;
@ -276,7 +276,7 @@ int main(int argc, char **argv)
pURL->ToNewCString(&url);
printf("Unable to load URL %s\n", url);
delete [] url;
nsAllocator::Free(url);
urlLoaded = 1;
}
}