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 <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2024-08-29 12:11:26 +02:00 committed by Anas Nashif
commit 2f02474448

View file

@ -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;
}