Bluetooth: Mesh: Fix unref null pointer
When pb-gatt advertising enabled, after extablish connect, will call `cb->connected` and `cb->adv_send`. In previous connected also clear `ADV_FLAG_PROXY` flag, but in `adv_send` will attempt unref null point buffers. Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
573c0d59e0
commit
58a501d6cd
1 changed files with 3 additions and 1 deletions
|
@ -343,9 +343,11 @@ static void adv_sent(struct bt_le_ext_adv *instance,
|
||||||
BT_DBG("Advertising stopped after %u ms", (uint32_t)duration);
|
BT_DBG("Advertising stopped after %u ms", (uint32_t)duration);
|
||||||
|
|
||||||
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
|
atomic_clear_bit(adv->flags, ADV_FLAG_ACTIVE);
|
||||||
|
atomic_clear_bit(adv->flags, ADV_FLAG_PROXY);
|
||||||
|
|
||||||
if (!atomic_test_and_clear_bit(adv->flags, ADV_FLAG_PROXY)) {
|
if (adv->buf) {
|
||||||
net_buf_unref(adv->buf);
|
net_buf_unref(adv->buf);
|
||||||
|
adv->buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)schedule_send(adv);
|
(void)schedule_send(adv);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue