Skip to contentSkip to conversation

hfp: Don't reply to crashed bluetoothd

PATCH New Daniel Wagner 1 participant 1 message Feb 10, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hfp: Don't reply to crashed bluetoothd

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(-)
plugins/hfp.c +4 -0
index 12d3457..acb297f 100644
@@ -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);
Signature · 1 line
1.7.3.3