On 06.09.2017 14:23, Peter Meerwald-Stadler wrote:
Dereference before null check
Coverity ID: #1454315
Signed-off-by: Peter Meerwald-Stadler <[email protected]>
---
src/modules/bluetooth/backend-ofono.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/bluetooth/backend-ofono.c
b/src/modules/bluetooth/backend-ofono.c
index 2c51497..782b353 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -545,11 +545,11 @@ static DBusMessage
*hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
return r;
}
- card = pa_hashmap_get(backend->cards, path);
+ pa_assert_se(card = pa_hashmap_get(backend->cards, path));
card->connecting = false;
- if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
+ if (codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
pa_log_warn("New audio connection invalid arguments (path=%s fd=%d,
codec=%d)", path, fd, codec);
pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments",
"Invalid arguments in method call"));
shutdown(fd, SHUT_RDWR);
Hi Peter,
wouldn't it be better to protect the access to card->connecting with an
"if (card)"?
The new_connection function() is called when a device requests a
connection and
I think PA should handle the case gracefully when an unknown device tries to
connect.
Regards
Georg
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss