[PATCH] Check session->msg at sync_getphonebook_callback() in file client/sync.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: wu.zheng <wu.zheng@xxxxxxxxx>

Otherwise,session->msg will be NULL and cause segmentation fault error.The reason is that the condition of transfer->fd>0 && session->msg is ok and session->msg will be set to NULL in the func of session_notify_progress when sync profile is used.

---
 client/sync.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/client/sync.c b/client/sync.c
index 3622a3d..28ace61 100644
--- a/client/sync.c
+++ b/client/sync.c
@@ -78,6 +78,9 @@ static void sync_getphonebook_callback(struct session_data *session,
 	DBusMessage *reply;
 	char *buf = NULL;
 
+	if (session->msg == NULL)
+		goto done;
+
 	reply = dbus_message_new_method_return(session->msg);
 
 	if (transfer->filled > 0)
@@ -91,6 +94,8 @@ static void sync_getphonebook_callback(struct session_data *session,
 	g_dbus_send_message(session->conn, reply);
 	dbus_message_unref(session->msg);
 	session->msg = NULL;
+done:
+	transfer_unregister(transfer); 
 }
 
 static DBusMessage *sync_getphonebook(DBusConnection *connection,
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux