mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Don't |delete| interface pointers. Use |AddRef()| and |Release()| instead. Bug #16762, r=pinkerton.
This commit is contained in:
parent
88adb975b9
commit
c84b487139
@ -142,15 +142,9 @@ nsresult nsGfxFactoryMac::CreateInstance(nsISupports *aOuter,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(inst);
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
// else {
|
||||
// inst->Release();
|
||||
// }
|
||||
NS_RELEASE(inst);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -106,12 +106,10 @@ nsresult nsLocaleMacFactory::CreateInstance(nsISupports *aOuter,
|
||||
if (NULL == inst) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
NS_ADDREF(inst);
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if(NS_FAILED(res)) {
|
||||
delete inst;
|
||||
}
|
||||
NS_RELEASE(inst);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -269,12 +269,9 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(inst);
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
NS_RELEASE(inst);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user