[pulseaudio-discuss] [PATCH 1/8] bluetooth: ofono: Fix Coverity warning

Peter Meerwald-Stadler pmeerw at pmeerw.net
Wed Sep 6 12:23:55 UTC 2017


Dereference before null check

Coverity ID: #1454315

Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net>
---
 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);
-- 
2.7.4



More information about the pulseaudio-discuss mailing list