Bluetooth: Check CCC before allocating buffer
Fixes memory leak when buffer is allocated before CCC check, the best fix is to move CCC check forward. Change-Id: Ib0492f629a339b576cf811adce47b2f6ab101c33 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
0fb7461140
commit
382488bbd0
1 changed files with 5 additions and 5 deletions
|
@ -303,6 +303,11 @@ static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
struct bt_buf *buf;
|
||||
struct bt_att_notify *nfy;
|
||||
|
||||
/* TODO: Handle indications */
|
||||
if (ccc->value != BT_GATT_CCC_NOTIFY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
conn = bt_conn_lookup_addr_le(&ccc->cfg[i].peer);
|
||||
if (!conn) {
|
||||
continue;
|
||||
|
@ -315,11 +320,6 @@ static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
return BT_GATT_ITER_STOP;
|
||||
}
|
||||
|
||||
/* TODO: Handle indications */
|
||||
if (ccc->value != BT_GATT_CCC_NOTIFY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BT_DBG("conn %p handle %u\n", conn, data->handle);
|
||||
|
||||
nfy = bt_buf_add(buf, sizeof(*nfy));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue