Bug 1073711: Clean up nsCacheService::CreateSessionInternal; drop useless null-check of 'this' and after 'new', and use nsRefPtr::forget(). r=mayhemer
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1318,22 +1318,19 @@ nsCacheService::CreateSession(const char
}
nsresult
nsCacheService::CreateSessionInternal(const char * clientID,
nsCacheStoragePolicy storagePolicy,
bool streamBased,
nsICacheSession **result)
{
- if (this == nullptr) return NS_ERROR_NOT_AVAILABLE;
-
- nsCacheSession * session = new nsCacheSession(clientID, storagePolicy, streamBased);
- if (!session) return NS_ERROR_OUT_OF_MEMORY;
-
- NS_ADDREF(*result = session);
+ nsRefPtr<nsCacheSession> session =
+ new nsCacheSession(clientID, storagePolicy, streamBased);
+ session.forget(result);
return NS_OK;
}
nsresult
nsCacheService::EvictEntriesForSession(nsCacheSession * session)
{