Bluetooth: GATT: Fix potential bt_conn reference leak
There was a missing bt_conn_unref() when bt_conn_lookup_addr_le() returns a connection that's not in BT_CONN_CONNECTED state. Change-Id: I4c6271d5bf596ea4d9b899e99ce1c7b7c8693f5e Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
d27447c674
commit
3a3238d1b0
1 changed files with 6 additions and 1 deletions
|
@ -543,7 +543,12 @@ static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)
|
|||
}
|
||||
|
||||
conn = bt_conn_lookup_addr_le(&ccc->cfg[i].peer);
|
||||
if (!conn || conn->state != BT_CONN_CONNECTED) {
|
||||
if (!conn) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (conn->state != BT_CONN_CONNECTED) {
|
||||
bt_conn_unref(conn);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue