Add chan->session check for NULL before dereferencing. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. --- profiles/audio/a2dp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index a3c294bc3..3f9deb9f8 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1893,7 +1893,8 @@ static int a2dp_reconfig(struct a2dp_channel *chan, const char *sender, } /* Check if stream is for the channel */ - if (!avdtp_has_stream(chan->session, tmp->stream)) + if (!chan->session || + !avdtp_has_stream(chan->session, tmp->stream)) continue; err = avdtp_close(chan->session, tmp->stream, FALSE); -- 2.43.0