ActivityMonitor: Fix leak of message when saving settings.

Adding a message to a message does not transfer ownership.
This commit is contained in:
Michael Lotz 2015-04-23 23:13:20 +02:00
parent ea9f4d993c
commit 8361c0f11a

View File

@ -335,14 +335,12 @@ ActivityWindow::_SaveSettings()
if (view == NULL)
continue;
BMessage* viewState = new BMessage;
status = view->SaveState(*viewState);
BMessage viewState;
status = view->SaveState(viewState);
if (status == B_OK)
status = settings.AddMessage("activity view", viewState);
if (status != B_OK) {
delete viewState;
status = settings.AddMessage("activity view", &viewState);
if (status != B_OK)
break;
}
}
if (status == B_OK)