Bluetooth: Mesh: Fix canceled buffer memory leak

In case a queued buffer is canceled before sending we have to unref
it, since that's what adv_send() would do as well.

Fixes #17936
Fixes #18013

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-08-13 16:28:51 +03:00 committed by Johan Hedberg
commit 5f6043bc35

View file

@ -186,6 +186,8 @@ static void adv_thread(void *p1, void *p2, void *p3)
if (BT_MESH_ADV(buf)->busy) {
BT_MESH_ADV(buf)->busy = 0U;
adv_send(buf);
} else {
net_buf_unref(buf);
}
STACK_ANALYZE("adv stack", adv_thread_stack);