mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bugzilla Bug 89539 Memory leak(s) when memory allocation fails.
r=dbaron sr=blizzard
This commit is contained in:
parent
46dc9b0d8e
commit
eaa56a62f2
@ -506,10 +506,13 @@ nsProtocolProxyService::AddNoProxyFor(const char* iHost, PRInt32 iPort)
|
||||
if (!hp)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
hp->host = new nsCString(iHost);
|
||||
if (!hp->host) {
|
||||
delete hp;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
hp->port = iPort;
|
||||
|
||||
nsAutoLock lock(mArrayLock);
|
||||
|
||||
return (mFiltersArray.AppendElement(hp)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -592,8 +595,10 @@ nsProtocolProxyService::LoadFilters(const char* filters)
|
||||
if (!hp)
|
||||
return; // fail silently
|
||||
hp->host = new nsCString(np, endproxy-np);
|
||||
if (!hp->host)
|
||||
if (!hp->host) {
|
||||
delete hp;
|
||||
return;
|
||||
}
|
||||
hp->port = nport>0 ? nport : -1;
|
||||
|
||||
mFiltersArray.AppendElement(hp);
|
||||
|
Loading…
Reference in New Issue
Block a user