Diff between 160b1bfa39e6e69f13f0a1293811f0e4e722168e and 4f656c7052b04cf3432a45ae4c042ac084f8d2d3

Changed Files

File Additions Deletions Status
profiles/network/connection.c +9 -3 modified

Full Patch

diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 9773b7b..7688beb 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -158,9 +158,13 @@ static void cancel_connection(struct network_conn *nc, const char *err_msg)
 		nc->watch = 0;
 	}
 
-	if (nc->msg && err_msg) {
-		reply = btd_error_failed(nc->msg, err_msg);
-		g_dbus_send_message(conn, reply);
+	if (nc->msg) {
+		if (err_msg) {
+			reply = btd_error_failed(nc->msg, err_msg);
+			g_dbus_send_message(conn, reply);
+		}
+		dbus_message_unref(nc->msg);
+		nc->msg = NULL;
 	}
 
 	g_io_channel_shutdown(nc->io, TRUE, NULL);
@@ -270,6 +274,8 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
 	g_dbus_send_reply(btd_get_dbus_connection(), nc->msg,
 			DBUS_TYPE_STRING, &pdev,
 			DBUS_TYPE_INVALID);
+	dbus_message_unref(nc->msg);
+	nc->msg = NULL;
 
 	connected = TRUE;
 	emit_property_changed(nc->peer->path,