Bug 235643 all _CreatePrintSettings leak on failure
changes code to handle OOM and optimizes code to skip an unnecessary QI patch by baafie@planet.nl r=timeless sr=bz a=asa git-svn-id: svn://10.0.0.236/trunk@174437 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e9aa06cbe2
commit
2fac05c441
@ -925,12 +925,11 @@ NS_IMETHODIMP nsPrintOptions::GetNativeData(PRInt16 aDataType, void * *_retval)
|
||||
nsresult nsPrintOptions::_CreatePrintSettings(nsIPrintSettings **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsPrintSettings* printSettings = new nsPrintSettings(); // does not initially ref count
|
||||
NS_ASSERTION(printSettings, "Can't be NULL!");
|
||||
|
||||
rv = printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
nsPrintSettings * printSettings = new nsPrintSettings(); // does not initially ref count
|
||||
NS_ENSURE_TRUE(printSettings, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*_retval = printSettings); // ref count
|
||||
InitPrintSettingsFromPrefs(*_retval, PR_FALSE, nsIPrintSettings::kInitSaveAll); // ignore return value
|
||||
|
||||
return rv;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user