Bluetooth: tester: Fix copying attribute to the server_buf

BT_GATT_INCLUDE_SERVICE user_data shall point to the service declaration
of service to be included. So user_data_len shall be set to 0 to avoid
copying the contents of bt_gatt_attr to the server_buf, and just use
pointer to the actual attribute.

Change-Id: Id770daeb6d64644c51f2bc5d3962dd80363ec8c3
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2016-06-28 10:57:44 +02:00
parent 437c0e18e3
commit c474a03c58

View file

@ -612,9 +612,12 @@ static int alloc_included(struct bt_gatt_attr *attr,
{
struct bt_gatt_attr *attr_incl;
/*
* user_data_len is set to 0 to NOT allocate memory in server_buf for
* user_data, just to assign to it attr pointer.
*/
attr_incl = gatt_db_add(&(struct bt_gatt_attr)
BT_GATT_INCLUDE_SERVICE(attr),
sizeof(*attr));
BT_GATT_INCLUDE_SERVICE(attr), 0);
if (!attr_incl) {
return -EINVAL;