Skip to content

Commit

Permalink
shared/bap: Fix crash unreg bcast src endpoint
Browse files Browse the repository at this point in the history
In bt_bap_stream_release stream is accessed after free
  • Loading branch information
silviubarbulescu authored and Vudentz committed Feb 23, 2024
1 parent a16c2cc commit 8f262a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/shared/bap.c
Expand Up @@ -5411,16 +5411,17 @@ unsigned int bt_bap_stream_release(struct bt_bap_stream *stream,
void *user_data)
{
unsigned int id;
struct bt_bap *bap = stream->bap;

if (!stream || !stream->ops || !stream->ops->release)
return 0;

if (!bt_bap_ref_safe(stream->bap))
if (!bt_bap_ref_safe(bap))
return 0;

id = stream->ops->release(stream, func, user_data);

bt_bap_unref(stream->bap);
bt_bap_unref(bap);

return id;
}
Expand Down

0 comments on commit 8f262a2

Please sign in to comment.