tests/bluetooth/tester: Allocate L2CAP channel only when needed
This fix leaking channels when autorization or key size are tested. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
4b40915004
commit
c631469539
|
@ -441,11 +441,6 @@ static int accept(struct bt_conn *conn, struct bt_l2cap_chan **l2cap_chan)
|
|||
{
|
||||
struct channel *chan;
|
||||
|
||||
chan = get_free_channel();
|
||||
if (!chan) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (bt_conn_enc_key_size(conn) < req_keysize) {
|
||||
return -EPERM;
|
||||
}
|
||||
|
@ -454,6 +449,11 @@ static int accept(struct bt_conn *conn, struct bt_l2cap_chan **l2cap_chan)
|
|||
return -EACCES;
|
||||
}
|
||||
|
||||
chan = get_free_channel();
|
||||
if (!chan) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
chan->le.chan.ops = &l2cap_ops;
|
||||
chan->le.rx.mtu = DATA_MTU_INITIAL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue