mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +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)
|
if (!hp)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
hp->host = new nsCString(iHost);
|
hp->host = new nsCString(iHost);
|
||||||
|
if (!hp->host) {
|
||||||
|
delete hp;
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
hp->port = iPort;
|
hp->port = iPort;
|
||||||
|
|
||||||
nsAutoLock lock(mArrayLock);
|
nsAutoLock lock(mArrayLock);
|
||||||
|
|
||||||
return (mFiltersArray.AppendElement(hp)) ? NS_OK : NS_ERROR_FAILURE;
|
return (mFiltersArray.AppendElement(hp)) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,8 +595,10 @@ nsProtocolProxyService::LoadFilters(const char* filters)
|
|||||||
if (!hp)
|
if (!hp)
|
||||||
return; // fail silently
|
return; // fail silently
|
||||||
hp->host = new nsCString(np, endproxy-np);
|
hp->host = new nsCString(np, endproxy-np);
|
||||||
if (!hp->host)
|
if (!hp->host) {
|
||||||
|
delete hp;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
hp->port = nport>0 ? nport : -1;
|
hp->port = nport>0 ? nport : -1;
|
||||||
|
|
||||||
mFiltersArray.AppendElement(hp);
|
mFiltersArray.AppendElement(hp);
|
||||||
|
Loading…
Reference in New Issue
Block a user