int num_models = 0;
bluetooth_mesh_network_t net;
bluetooth_mesh_node_t param_node;
- bluetooth_mesh_model_t **param_model;
+ bluetooth_mesh_model_t **param_model = NULL;
bt_mesh_network_s *network_s;
bt_mesh_netkey_s *netkey_s;
for (int i = 0; i < num_models; i++)
g_free(param_model[i]);
+ g_free(param_model);
+
return error_code;
}
for (int i = 0; i < num_models; i++)
g_free(param_model[i]);
+ g_free(param_model);
+
FUNC_EXIT;
return error_code;
}
break;
}
case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_NAME: {
- char* network_name;
+ char* network_name = NULL;
ret = bt_mesh_network_get_name(network, &network_name);
TC_PRT("return %s\n", __bt_get_error_message(ret));
if (ret == BT_ERROR_NONE)
TC_PRT("network name is [%s]", network_name);
+
+ g_free(network_name);
break;
}
case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_ADD_NETKEY: {
break;
}
case BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY: {
- char* value;
+ char *value = NULL;
int len;
bool auth_reply;
if (g_test_param.param_count != 2) {
break;
}
len = strlen(g_test_param.params[0]);
- value = g_malloc0(len+1);
- g_strlcpy(value, g_test_param.params[0], len+1);
+ value = g_malloc0(len + 1);
+ g_strlcpy(value, g_test_param.params[0], len + 1);
auth_reply = atoi(g_test_param.params[1]);
TC_PRT("\nauth_value is [%s]\n", value);
TC_PRT("auth_reply is [%d]\n", auth_reply);
TC_PRT("auth_type is [%d]\n", request_type);
ret = bt_mesh_authentication_reply(request_type, (const char*)value, auth_reply);
TC_PRT("return %s\n", __bt_get_error_message(ret));
+ g_free(value);
break;
}
case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_PROVISIONING_CAPABILITIES: {
__bt_mesh_model_msg_cb, NULL);
TC_PRT("return %s\n", __bt_get_error_message(ret));
+ g_free(msg_params);
+
break;
}
case BT_MESH_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS: {
TC_PRT("remote_name: %s", device_info->remote_name);
TC_PRT("is_connected: %d", device_info->is_connected);
TC_PRT("service_count: %d", device_info->service_count);
+
TC_PRT("service 0x%x, major 0x%x, minor 0x%x", device_info->bt_class.major_service_class_mask,
device_info->bt_class.major_device_class,
device_info->bt_class.minor_device_class);
ret = bt_adapter_le_set_advertising_device_name(advertiser,
BT_ADAPTER_LE_PACKET_SCAN_RESPONSE, true);
- if (ret != BT_ERROR_NONE)
+ if (ret != BT_ERROR_NONE) {
TC_PRT("set device name [0x%04x]", ret);
return 0;
+ }
default:
TC_PRT("No adv data");
ret = bt_mesh_group_send_msg(group_h, appkey_h, msg_params,
__bt_mesh_model_msg_cb, NULL);
+
+ g_free(msg_params);
+
assert_eq(ret, BT_ERROR_NONE);
wait_for_async();
} else {
ret = bt_mesh_model_send_msg(model_h, appkey_h, msg_params,
__bt_mesh_model_msg_cb, NULL);
+
+ g_free(msg_params);
+
assert_eq(ret, BT_ERROR_NONE);
wait_for_async();
} else {