mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 501577 - Add a missing call to Release in nsXPCWrappedJS::GetNewOrUsed. Also remove a hack needed to get around the missing release. r+sr=peterv
This commit is contained in:
parent
e924b93855
commit
3a7c25ffc5
@ -307,6 +307,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
||||
nsXPCWrappedJS* wrapper = nsnull;
|
||||
nsXPCWrappedJSClass* clazz = nsnull;
|
||||
XPCJSRuntime* rt = ccx.GetRuntime();
|
||||
JSBool release_root = JS_FALSE;
|
||||
|
||||
map = rt->GetWrappedJSMap();
|
||||
if(!map)
|
||||
@ -341,6 +342,7 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!root)
|
||||
{
|
||||
// build the root wrapper
|
||||
@ -374,6 +376,9 @@ nsXPCWrappedJS::GetNewOrUsed(XPCCallContext& ccx,
|
||||
|
||||
if(!root)
|
||||
goto return_wrapper;
|
||||
|
||||
release_root = JS_TRUE;
|
||||
|
||||
{ // scoped lock
|
||||
#if DEBUG_xpc_leaks
|
||||
printf("Created nsXPCWrappedJS %p, JSObject is %p\n",
|
||||
@ -407,6 +412,9 @@ return_wrapper:
|
||||
if(clazz)
|
||||
NS_RELEASE(clazz);
|
||||
|
||||
if(release_root)
|
||||
NS_RELEASE(root);
|
||||
|
||||
if(!wrapper)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user