Skip to content

Commit 06aea98

Browse files
author
Seppo Takalo
committed
Call "new" instead of no-throw version and the MBED_ERROR.
Standard new operator already calls MBED_ERROR in failure.
1 parent 86019af commit 06aea98

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

features/netsocket/NetworkInterface.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,7 @@ static void call_all_event_listeners(NetworkInterface *iface, nsapi_event_t even
105105
void NetworkInterface::add_event_listener(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
106106
{
107107
iface_eventlist_t *event_list = get_interface_event_list_head();
108-
iface_eventlist_entry_t *entry = new (std::nothrow) iface_eventlist_entry_t;
109-
if (!entry) {
110-
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_ENOMEM), "Failed to allocate entry");
111-
return;
112-
}
108+
iface_eventlist_entry_t *entry = new iface_eventlist_entry_t;
113109
entry->iface = this;
114110
entry->status_cb = status_cb;
115111
ns_list_add_to_end(event_list, entry);

0 commit comments

Comments
 (0)