diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 125521f68a32f..fe934cb67873f 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -172,6 +172,7 @@ config BT_BUF_CMD_TX_SIZE config BT_BUF_CMD_TX_COUNT int "Number of HCI command buffers" + default 3 if BT_EXT_ADV && BT_CENTRAL default 2 range 2 64 help diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 734abeb26a1c2..b785650ad9c52 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -858,6 +858,9 @@ int bt_le_create_conn_cancel(void) struct bt_hci_cmd_state_set state; buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0); + if (!buf) { + return -ENOBUFS; + } bt_hci_cmd_state_set_init(buf, &state, bt_dev.flags, BT_DEV_INITIATING, false);