ble_mesh: fix failed to set device role caused mem leak

This commit is contained in:
lly 2019-09-02 13:08:05 +08:00
parent 624bf7e3a0
commit b8cb769ce3
7 changed files with 16 additions and 16 deletions

View file

@ -612,7 +612,7 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
role_param.role = cb.params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
btc_ble_mesh_config_client_get_state(arg->cfg_client_get_state.params,
arg->cfg_client_get_state.get_state,
@ -628,7 +628,7 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
role_param.role = cb.params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
btc_ble_mesh_config_client_set_state(arg->cfg_client_set_state.params,
arg->cfg_client_set_state.set_state,

View file

@ -458,7 +458,7 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;
@ -484,7 +484,7 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;

View file

@ -410,7 +410,7 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg)
role_param.role = cb.params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
btc_ble_mesh_health_client_get_state(arg->health_client_get_state.params,
arg->health_client_get_state.get_state, &cb);
@ -426,7 +426,7 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg)
role_param.role = cb.params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
btc_ble_mesh_health_client_set_state(arg->health_client_set_state.params,
arg->health_client_set_state.set_state, &cb);

View file

@ -302,7 +302,7 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;
@ -328,7 +328,7 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;

View file

@ -1454,7 +1454,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
common.role = arg->model_publish.device_role;
if (bt_mesh_set_client_model_role(&common)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
}
err = bt_mesh_model_publish((struct bt_mesh_model *)arg->model_publish.model);
@ -1466,7 +1466,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + 8);
if (!buf) {
LOG_ERROR("%s, Failed to allocate memory", __func__);
return;
break;
}
net_buf_simple_add_mem(buf, arg->model_send.data, arg->model_send.length);
arg->model_send.ctx->srv_send = true;
@ -1484,7 +1484,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + 8);
if (!buf) {
LOG_ERROR("%s, Failed to allocate memory", __func__);
return;
break;
}
net_buf_simple_add_mem(buf, arg->model_send.data, arg->model_send.length);
arg->model_send.ctx->srv_send = false;
@ -1492,7 +1492,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
common.role = arg->model_send.device_role;
if (bt_mesh_set_client_model_role(&common)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
err = bt_mesh_client_send_msg((struct bt_mesh_model *)arg->model_send.model,
arg->model_send.opcode,

View file

@ -547,7 +547,7 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;
@ -573,7 +573,7 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;

View file

@ -304,7 +304,7 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;
@ -330,7 +330,7 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
role_param.role = params->msg_role;
if (bt_mesh_set_client_model_role(&role_param)) {
LOG_ERROR("%s, Failed to set model role", __func__);
return;
break;
}
common.opcode = params->opcode;
common.model = (struct bt_mesh_model *)params->model;