Bluetooth: Mesh: Fix reference count imbalance in bt_mesh_net_resend()

The commit 1c7b668804 tried to fix
resending segments to the GATT bearer, however it got the buffer
refernce counting wrong. The bt_mesh_net_resend() function doesn't
own a reference to the buffer, i.e. it's not responsible for unrefing
it. E.g. bt_mesh_adv_send() takes its own reference.

What was missing however was the handling of the callbacks. Use the
recently introduced send_cb_finalize() helper to make sure they're
called.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-08-15 08:37:49 +03:00 committed by Carles Cufí
commit 286a59c8b5

View file

@ -783,7 +783,7 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) &&
bt_mesh_proxy_relay(&buf->b, dst)) {
net_buf_unref(buf);
send_cb_finalize(cb, cb_data);
} else {
bt_mesh_adv_send(buf, cb, cb_data);
}