From 594f67ec04ff2a5f1d52fa88c8e4272fef484cb2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 11 Oct 2021 11:22:36 +0200 Subject: [PATCH] a2dp: guard against transport NULL The transport can become NULL so check that and don't try to deref it. --- spa/plugins/bluez5/a2dp-sink.c | 3 ++- spa/plugins/bluez5/a2dp-source.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 3775acaeb..aa0b4f3b0 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -254,7 +254,8 @@ static int impl_node_enum_params(void *object, int seq, if (enum_codec) { int res; - if (this->codec->enum_props == NULL || this->codec_props == NULL) + if (this->codec->enum_props == NULL || this->codec_props == NULL || + this->transport == NULL) return 0; else if ((res = this->codec->enum_props(this->codec_props, this->transport->device->settings, diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 2d95ae369..cd23dffae 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -239,7 +239,8 @@ static int impl_node_enum_params(void *object, int seq, if (enum_codec) { int res; - if (this->codec->enum_props == NULL || this->codec_props == NULL) + if (this->codec->enum_props == NULL || this->codec_props == NULL || + this->transport == NULL) return 0; else if ((res = this->codec->enum_props(this->codec_props, this->transport->device->settings,