diff --git a/mtapi_c/src/embb_mtapi_task_t.c b/mtapi_c/src/embb_mtapi_task_t.c index 335e70d..e2f47dd 100644 --- a/mtapi_c/src/embb_mtapi_task_t.c +++ b/mtapi_c/src/embb_mtapi_task_t.c @@ -279,7 +279,8 @@ static mtapi_task_hndl_t embb_mtapi_task_start( /* schedule local task */ was_scheduled = MTAPI_TRUE; - for (mtapi_uint_t kk = 0; kk < task->attributes.num_instances; kk++) { + for (mtapi_uint_t kk = 0; kk < task->attributes.num_instances; + kk++) { was_scheduled = was_scheduled & embb_mtapi_scheduler_schedule_task(scheduler, task, kk); } diff --git a/mtapi_network_c/src/embb_mtapi_network.c b/mtapi_network_c/src/embb_mtapi_network.c index 65a335d..4605caa 100644 --- a/mtapi_network_c/src/embb_mtapi_network.c +++ b/mtapi_network_c/src/embb_mtapi_network.c @@ -583,36 +583,41 @@ mtapi_action_hndl_t mtapi_network_action_create( mtapi_action_hndl_t action_hndl = { 0, 0 }; int err; - // TODO: check action for allocation failure - action->domain_id = domain_id; - action->job_id = remote_job_id; - - embb_mtapi_network_buffer_initialize( - &action->send_buffer, plugin->buffer_size); - embb_mutex_init(&action->send_mutex, 0); - - action->host = host; - action->port = port; - embb_mtapi_network_socket_initialize(&action->socket); - err = embb_mtapi_network_socket_connect(&action->socket, host, port); - - if (0 != err) { - // store socket for select - plugin->sockets[plugin->socket_count] = action->socket; - plugin->socket_count++; - - action_hndl = mtapi_ext_plugin_action_create( - local_job_id, - network_task_start, - network_task_cancel, - network_action_finalize, - action, - NULL, 0, // no node local data obviously - MTAPI_NULL, - &local_status); - - mtapi_status_set(status, local_status); + if (NULL != action) { + action->domain_id = domain_id; + action->job_id = remote_job_id; + + embb_mtapi_network_buffer_initialize( + &action->send_buffer, plugin->buffer_size); + embb_mutex_init(&action->send_mutex, 0); + + action->host = host; + action->port = port; + embb_mtapi_network_socket_initialize(&action->socket); + err = embb_mtapi_network_socket_connect(&action->socket, host, port); + + if (0 != err) { + // store socket for select + plugin->sockets[plugin->socket_count] = action->socket; + plugin->socket_count++; + + action_hndl = mtapi_ext_plugin_action_create( + local_job_id, + network_task_start, + network_task_cancel, + network_action_finalize, + action, + NULL, 0, // no node local data obviously + MTAPI_NULL, + &local_status); + } else { + embb_mutex_destroy(&action->send_mutex); + embb_mtapi_network_buffer_finalize(&action->send_buffer); + embb_mtapi_network_socket_finalize(&action->socket); + embb_free(action); + } } + mtapi_status_set(status, local_status); return action_hndl; }