Bug 997686 - SocketTransportService infaliible malloc cleanup r=sworkman

This commit is contained in:
Patrick McManus 2014-04-15 22:41:06 -04:00
parent 482505a98c
commit 33a8c7d829

View File

@ -619,18 +619,13 @@ nsSocketTransportService::CreateTransport(const char **types,
NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_TRUE(port >= 0 && port <= 0xFFFF, NS_ERROR_ILLEGAL_VALUE);
nsSocketTransport *trans = new nsSocketTransport();
if (!trans)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(trans);
nsRefPtr<nsSocketTransport> trans = new nsSocketTransport();
nsresult rv = trans->Init(types, typeCount, host, port, proxyInfo);
if (NS_FAILED(rv)) {
NS_RELEASE(trans);
return rv;
}
*result = trans;
trans.forget(result);
return NS_OK;
}
@ -648,8 +643,6 @@ nsSocketTransportService::CreateUnixDomainTransport(nsIFile *aPath,
return rv;
nsRefPtr<nsSocketTransport> trans = new nsSocketTransport();
if (!trans)
return NS_ERROR_OUT_OF_MEMORY;
rv = trans->InitWithFilename(path.get());
if (NS_FAILED(rv))