mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
bug#16742 Fixing delete on nsISupports. Thanks for patch from
<heikki@citec.fi> r=dp
This commit is contained in:
parent
038812ce67
commit
164208885d
@ -637,10 +637,10 @@ CreateJSComponentLoader(nsISupports *aOuter, const nsIID &iid, void **result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = 0;
|
||||
nsISupports *inst = 0;
|
||||
mozJSComponentLoader *inst;
|
||||
|
||||
if (iid.Equals(NS_GET_IID(nsIComponentLoader))) {
|
||||
inst = (nsISupports *)new mozJSComponentLoader();
|
||||
inst = new mozJSComponentLoader();
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
@ -648,10 +648,12 @@ CreateJSComponentLoader(nsISupports *aOuter, const nsIID &iid, void **result)
|
||||
if (!inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(inst); // Stabilize
|
||||
|
||||
nsresult rv = inst->QueryInterface(iid, result);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete inst;
|
||||
}
|
||||
|
||||
NS_RELEASE(inst); // Destabilize and avoid leaks. Avoid calling delete <interface pointer>
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user