Fix possible resource leakage
* Also use the std::nothrow behaviour of operator new * and remove extra indent Fix CID 10948
This commit is contained in:
@@ -95,7 +95,9 @@ DecorSettingsView::MessageReceived(BMessage *msg)
|
|||||||
if (msg->FindString("decor", &newDecor) != B_OK)
|
if (msg->FindString("decor", &newDecor) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
DecorInfoUtility* decorUtility = new DecorInfoUtility();
|
DecorInfoUtility* decorUtility
|
||||||
|
= new(std::nothrow) DecorInfoUtility();
|
||||||
|
|
||||||
if (decorUtility == NULL)
|
if (decorUtility == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -113,7 +115,9 @@ DecorSettingsView::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
case kMsgDecorInfo:
|
case kMsgDecorInfo:
|
||||||
{
|
{
|
||||||
DecorInfoUtility* decorUtility = new DecorInfoUtility();
|
DecorInfoUtility* decorUtility
|
||||||
|
= new(std::nothrow) DecorInfoUtility();
|
||||||
|
|
||||||
if (decorUtility == NULL)
|
if (decorUtility == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -203,12 +207,16 @@ DecorSettingsView::_SetCurrentDecor()
|
|||||||
void
|
void
|
||||||
DecorSettingsView::SetDefaults()
|
DecorSettingsView::SetDefaults()
|
||||||
{
|
{
|
||||||
DecorInfoUtility* decorUtility = new DecorInfoUtility();
|
DecorInfoUtility* decorUtility
|
||||||
if (decorUtility == NULL)
|
= new(std::nothrow) DecorInfoUtility();
|
||||||
return;
|
|
||||||
|
if (decorUtility == NULL)
|
||||||
|
return;
|
||||||
DecorInfo* defaultDecorator(decorUtility->DefaultDecorator());
|
DecorInfo* defaultDecorator(decorUtility->DefaultDecorator());
|
||||||
decorUtility->SetDecorator(defaultDecorator);
|
decorUtility->SetDecorator(defaultDecorator);
|
||||||
_BuildDecorMenu();
|
_BuildDecorMenu();
|
||||||
|
|
||||||
|
delete decorUtility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user