зеркало из https://github.com/mozilla/gecko-dev.git
Bug 235643 all _CreatePrintSettings leak on failure
patch by baafie@planet.nl r=timeless sr=bz a=asa
This commit is contained in:
Родитель
33b4f10224
Коммит
7c6d1fa65f
|
@ -67,13 +67,18 @@ nsPrintOptionsX::~nsPrintOptionsX()
|
|||
nsresult nsPrintOptionsX::_CreatePrintSettings(nsIPrintSettings **_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
*_retval = nsnull;
|
||||
|
||||
nsPrintSettingsX* printSettings = new nsPrintSettingsX; // does not initially ref count
|
||||
if (!printSettings)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ENSURE_TRUE(printSettings, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*_retval = printSettings); // ref count
|
||||
|
||||
rv = printSettings->Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
|
||||
NS_RELEASE(*_retval);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
|
|
|
@ -62,9 +62,12 @@ nsPrintOptionsWin::~nsPrintOptionsWin()
|
|||
/* nsIPrintSettings CreatePrintSettings (); */
|
||||
nsresult nsPrintOptionsWin::_CreatePrintSettings(nsIPrintSettings **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
nsPrintSettingsWin* printSettings = new nsPrintSettingsWin(); // does not initially ref count
|
||||
NS_ASSERTION(printSettings, "Can't be NULL!");
|
||||
NS_ENSURE_TRUE(printSettings, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
|
||||
NS_ADDREF(*_retval = printSettings); // ref count
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче