Bluetooth: GATT: Fix possible bt_conn leak
If other peers were present but not in CONNECTED state temporary connection reference was leaked. Change-Id: Icc32bfe1a86f92a9d8472991476ebfd26c889d84 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
6ee34adff4
commit
c80cf24e03
1 changed files with 6 additions and 2 deletions
|
@ -561,9 +561,13 @@ static uint8_t disconnected_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
|
||||
/* Skip if there is another peer connected */
|
||||
tmp = bt_conn_lookup_addr_le(&ccc->cfg[i].peer);
|
||||
if (tmp && tmp->state == BT_CONN_CONNECTED) {
|
||||
if (tmp) {
|
||||
if (tmp->state == BT_CONN_CONNECTED) {
|
||||
bt_conn_unref(tmp);
|
||||
return BT_GATT_ITER_CONTINUE;
|
||||
}
|
||||
|
||||
bt_conn_unref(tmp);
|
||||
return BT_GATT_ITER_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue