Fix CID 879. We leaked some stuff in case of error. Removed useless check.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38247 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2010-08-18 19:53:08 +00:00
parent 65341d518f
commit 1c9ed76e33

View File

@ -103,14 +103,20 @@ BMailChain::Load(BMessage* settings)
break; break;
} }
if (!filter_settings.AddItem(filter) || !filter_addons.AddItem(ref)) if (!filter_settings.AddItem(filter)) {
break; delete filter;
delete ref;
return B_NO_MEMORY;
}
if (!filter_addons.AddItem(ref)) {
filter_settings.RemoveItem(filter);
delete filter;
delete ref;
return B_NO_MEMORY;
}
} }
if (filter_settings.CountItems() != settings_ct
|| filter_addons.CountItems() != addons_ct)
return B_NO_MEMORY;
return B_OK; return B_OK;
} }