mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 321057 crash [@ NS_NewToolkitProfileService] because it doesn't handle OOM
r=bsmedberg
This commit is contained in:
parent
de602581d2
commit
23ec290fe6
@ -846,15 +846,17 @@ nsToolkitProfileService::LockFactory(PRBool aVal)
|
||||
nsresult
|
||||
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult)
|
||||
{
|
||||
nsToolkitProfileService* aThis = new nsToolkitProfileService();
|
||||
nsresult rv = aThis->Init();
|
||||
nsToolkitProfileService* profileService = new nsToolkitProfileService();
|
||||
if (!profileService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsresult rv = profileService->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("nsToolkitProfileService::Init failed!");
|
||||
delete aThis;
|
||||
delete profileService;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = aThis);
|
||||
NS_ADDREF(*aResult = profileService);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user