Bluetooth: Classic: SDP: Fix buf leak issue

In the function `sdp_client_ss_search()` and
`sdp_client_ssa_search()`, the allocated buf is not released if the
required UUID is invalid.

Un-reference the allocated net buffer if the UUID is invalid.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This commit is contained in:
Lyle Zhu 2025-06-06 10:11:11 +08:00 committed by Dan Kalowsky
commit 6231b43435

View file

@ -1515,6 +1515,7 @@ static int sdp_client_ss_search(struct bt_sdp_client *session,
break;
default:
LOG_ERR("Unknown UUID type %u", param->uuid->type);
net_buf_unref(buf);
return -EINVAL;
}
@ -1620,6 +1621,7 @@ static int sdp_client_ssa_search(struct bt_sdp_client *session,
break;
default:
LOG_ERR("Unknown UUID type %u", param->uuid->type);
net_buf_unref(buf);
return -EINVAL;
}