In case bluetoothd crashes randomly the data pointer can
be NULL. So we shouldn't derefernce it.
---
 plugins/hfp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/hfp.c b/plugins/hfp.c
index 12d3457..acb297f 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -569,6 +569,9 @@ static void hfp_connect_reply(DBusPendingCall *call, 
gpointer user_data)
 
        DBG("Connect reply: %s", derr.message);
 
+       if (data == NULL)
+               goto poweroff;
+
        if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) {
                msg = dbus_message_new_method_call(BLUEZ_SERVICE,
                                data->handsfree_path,
@@ -579,6 +582,7 @@ static void hfp_connect_reply(DBusPendingCall *call, 
gpointer user_data)
                        g_dbus_send_message(connection, msg);
        }
 
+poweroff:
        ofono_modem_set_powered(modem, FALSE);
 
        dbus_error_free(&derr);
-- 
1.7.3.3

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to