зеркало из https://github.com/mozilla/pjs.git
Fixed mismatched delete problem (purify).
This commit is contained in:
Родитель
e6ca89c1bb
Коммит
5c61055a2b
|
@ -198,22 +198,12 @@ class nsOnStartRequestEvent : public nsStreamListenerEvent
|
||||||
public:
|
public:
|
||||||
nsOnStartRequestEvent(nsAsyncStreamObserver* listener,
|
nsOnStartRequestEvent(nsAsyncStreamObserver* listener,
|
||||||
nsIChannel* channel, nsISupports* context)
|
nsIChannel* channel, nsISupports* context)
|
||||||
: nsStreamListenerEvent(listener, channel, context),
|
: nsStreamListenerEvent(listener, channel, context) {}
|
||||||
mContentType(nsnull) {}
|
virtual ~nsOnStartRequestEvent() {}
|
||||||
virtual ~nsOnStartRequestEvent();
|
|
||||||
|
|
||||||
NS_IMETHOD HandleEvent();
|
NS_IMETHOD HandleEvent();
|
||||||
|
|
||||||
protected:
|
|
||||||
char* mContentType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nsOnStartRequestEvent::~nsOnStartRequestEvent()
|
|
||||||
{
|
|
||||||
if (mContentType)
|
|
||||||
delete[] mContentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsOnStartRequestEvent::HandleEvent()
|
nsOnStartRequestEvent::HandleEvent()
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,8 +41,8 @@ nsSimpleURI::nsSimpleURI(nsISupports* outer)
|
||||||
|
|
||||||
nsSimpleURI::~nsSimpleURI()
|
nsSimpleURI::~nsSimpleURI()
|
||||||
{
|
{
|
||||||
if (mScheme) delete[] mScheme;
|
if (mScheme) nsCRT::free(mScheme);
|
||||||
if (mPath) delete[] mPath;
|
if (mPath) nsCRT::free(mPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_AGGREGATED(nsSimpleURI);
|
NS_IMPL_AGGREGATED(nsSimpleURI);
|
||||||
|
|
|
@ -121,7 +121,7 @@ nsFileChannel::Init(nsFileProtocolHandler* handler,
|
||||||
rv = mURI->GetSpec(&url);
|
rv = mURI->GetSpec(&url);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
nsFileURL fileURL(url);
|
nsFileURL fileURL(url);
|
||||||
delete [] url;
|
nsCRT::free(url);
|
||||||
mSpec = fileURL;
|
mSpec = fileURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ nsFileChannel::GetContentType(char * *aContentType)
|
||||||
|
|
||||||
nsIMIMEInfo *MIMEInfo = nsnull;
|
nsIMIMEInfo *MIMEInfo = nsnull;
|
||||||
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
|
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
|
||||||
delete [] ext;
|
nsAllocator::Free(ext);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = MIMEInfo->GetMIMEType(aContentType);
|
rv = MIMEInfo->GetMIMEType(aContentType);
|
||||||
|
|
|
@ -541,7 +541,7 @@ nsFtpConnectionThread::Run() {
|
||||||
|
|
||||||
char *p = newPath.ToNewCString();
|
char *p = newPath.ToNewCString();
|
||||||
mUrl->SetPath(p);
|
mUrl->SetPath(p);
|
||||||
delete [] p;
|
nsAllocator::Free(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ nsHTTPChannel::GetContentType(char * *aContentType)
|
||||||
|
|
||||||
nsIMIMEInfo *MIMEInfo = nsnull;
|
nsIMIMEInfo *MIMEInfo = nsnull;
|
||||||
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
|
rv = MIMEService->GetFromExtension(ext, &MIMEInfo);
|
||||||
delete [] ext;
|
nsAllocator::Free(ext);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// default to text/html
|
// default to text/html
|
||||||
*aContentType = nsCRT::strdup(DUMMY_TYPE);
|
*aContentType = nsCRT::strdup(DUMMY_TYPE);
|
||||||
|
|
|
@ -721,7 +721,7 @@ nsresult nsHTTPResponseListener::ProcessRedirection(PRInt32 aStatusCode)
|
||||||
m_ResponseContext = nsnull;
|
m_ResponseContext = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] location;
|
nsCRT::free(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -291,7 +291,7 @@ nsStreamConverterService::FindConverter(const char *aProgID, nsVoidArray **aEdge
|
||||||
curVertexAtom->ToString(curVertexStr);
|
curVertexAtom->ToString(curVertexStr);
|
||||||
char * curVertexCString = curVertexStr.ToNewCString();
|
char * curVertexCString = curVertexStr.ToNewCString();
|
||||||
nsStringKey *curVertex = new nsStringKey(curVertexCString);
|
nsStringKey *curVertex = new nsStringKey(curVertexCString);
|
||||||
delete [] curVertexCString;
|
nsAllocator::Free(curVertexCString);
|
||||||
|
|
||||||
SCTableData *data = (SCTableData*)lBFSTable.Get(curVertex);
|
SCTableData *data = (SCTableData*)lBFSTable.Get(curVertex);
|
||||||
BFSState *curVertexState = (BFSState*)data->data;
|
BFSState *curVertexState = (BFSState*)data->data;
|
||||||
|
@ -343,12 +343,12 @@ nsStreamConverterService::FindConverter(const char *aProgID, nsVoidArray **aEdge
|
||||||
|
|
||||||
char *from = predecessorData->keyString->ToNewCString();
|
char *from = predecessorData->keyString->ToNewCString();
|
||||||
newProgID->Append(from);
|
newProgID->Append(from);
|
||||||
delete [] from;
|
nsAllocator::Free(from);
|
||||||
|
|
||||||
newProgID->Append("?to=");
|
newProgID->Append("?to=");
|
||||||
char *to = data->keyString->ToNewCString();
|
char *to = data->keyString->ToNewCString();
|
||||||
newProgID->Append(to);
|
newProgID->Append(to);
|
||||||
delete [] to;
|
nsAllocator::Free(to);
|
||||||
|
|
||||||
// Add this PROGID to the chain.
|
// Add this PROGID to the chain.
|
||||||
shortestPath->AppendElement(newProgID);
|
shortestPath->AppendElement(newProgID);
|
||||||
|
@ -389,14 +389,14 @@ nsStreamConverterService::Convert(nsIInputStream *aFromStream,
|
||||||
// couldn't go direct, let's try walking the graph of converters.
|
// couldn't go direct, let's try walking the graph of converters.
|
||||||
rv = BuildGraph();
|
rv = BuildGraph();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
delete [] cProgID;
|
nsAllocator::Free(cProgID);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsVoidArray *converterChain = nsnull;
|
nsVoidArray *converterChain = nsnull;
|
||||||
|
|
||||||
rv = FindConverter(cProgID, &converterChain);
|
rv = FindConverter(cProgID, &converterChain);
|
||||||
delete [] cProgID;
|
nsAllocator::Free(cProgID);
|
||||||
cProgID = nsnull;
|
cProgID = nsnull;
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// can't make this conversion.
|
// can't make this conversion.
|
||||||
|
@ -423,7 +423,7 @@ nsStreamConverterService::Convert(nsIInputStream *aFromStream,
|
||||||
|
|
||||||
nsString2 fromStr(eOneByte), toStr(eOneByte);
|
nsString2 fromStr(eOneByte), toStr(eOneByte);
|
||||||
rv = ParseFromTo(lProgID, fromStr, toStr);
|
rv = ParseFromTo(lProgID, fromStr, toStr);
|
||||||
delete [] lProgID;
|
nsAllocator::Free(lProgID);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsIStreamConverter *conv = nsnull;
|
nsIStreamConverter *conv = nsnull;
|
||||||
|
@ -477,14 +477,14 @@ nsStreamConverterService::AsyncConvertData(const PRUnichar *aFromType,
|
||||||
// couldn't go direct, let's try walking the graph of converters.
|
// couldn't go direct, let's try walking the graph of converters.
|
||||||
rv = BuildGraph();
|
rv = BuildGraph();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
delete [] cProgID;
|
nsAllocator::Free(cProgID);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsVoidArray *converterChain = nsnull;
|
nsVoidArray *converterChain = nsnull;
|
||||||
|
|
||||||
rv = FindConverter(cProgID, &converterChain);
|
rv = FindConverter(cProgID, &converterChain);
|
||||||
delete [] cProgID;
|
nsAllocator::Free(cProgID);
|
||||||
cProgID = nsnull;
|
cProgID = nsnull;
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// can't make this conversion.
|
// can't make this conversion.
|
||||||
|
@ -511,7 +511,7 @@ nsStreamConverterService::AsyncConvertData(const PRUnichar *aFromType,
|
||||||
|
|
||||||
nsString2 fromStr(eOneByte), toStr(eOneByte);
|
nsString2 fromStr(eOneByte), toStr(eOneByte);
|
||||||
rv = ParseFromTo(lProgID, fromStr, toStr);
|
rv = ParseFromTo(lProgID, fromStr, toStr);
|
||||||
delete [] lProgID;
|
nsAllocator::Free(lProgID);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsIStreamConverter *conv = nsnull;
|
nsIStreamConverter *conv = nsnull;
|
||||||
|
|
|
@ -143,7 +143,7 @@ NS_IMETHODIMP TestConsumer::OnStopRequest(nsISupports *context, nsIChannel* chan
|
||||||
mUrl->ToNewCString(&url);
|
mUrl->ToNewCString(&url);
|
||||||
|
|
||||||
printf("Unable to load URL %s\n", url);
|
printf("Unable to load URL %s\n", url);
|
||||||
delete [] url;
|
nsAllocator::Free(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
urlLoaded = 1;
|
urlLoaded = 1;
|
||||||
|
@ -276,7 +276,7 @@ int main(int argc, char **argv)
|
||||||
pURL->ToNewCString(&url);
|
pURL->ToNewCString(&url);
|
||||||
|
|
||||||
printf("Unable to load URL %s\n", url);
|
printf("Unable to load URL %s\n", url);
|
||||||
delete [] url;
|
nsAllocator::Free(url);
|
||||||
urlLoaded = 1;
|
urlLoaded = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче