From 2f024744486b4d23411129de4ac90d6d39900f11 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 29 Aug 2024 12:11:26 +0200 Subject: [PATCH] bluetooth: host: adv: Release buf if failed to set addr The `bt_id_set_adv_own_addr` function itself tries to allocate a buffer for the command and it failes due to lack of buffers, it returns error. However, the `le_ext_adv_param_set` function doesn't handle the error properly and keeps its own allocated buffer. This commit releases the allocated buffer. Partially fixes mesh in #77241. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/adv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index e67751e1953..29a029ea0de 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -1139,6 +1139,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, err = bt_id_set_adv_own_addr(adv, param->options, dir_adv, &cp->own_addr_type); if (err) { + net_buf_unref(buf); return err; }