Bluetooth: host: Fix handling of scan start failed

Handle scan start failed and release the connection object in this case.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-02-03 12:06:11 +01:00 committed by Johan Hedberg
commit 794cbd641b

View file

@ -2253,7 +2253,12 @@ struct bt_conn *bt_conn_create_le(const bt_addr_le_t *peer,
if (!bt_dev.le.rl_size || bt_dev.le.rl_entries > bt_dev.le.rl_size) {
bt_conn_set_state(conn, BT_CONN_CONNECT_SCAN);
bt_le_scan_update(true);
if (bt_le_scan_update(true)) {
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
bt_conn_unref(conn);
return NULL;
}
return conn;
}