All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Cc: "Gustavo F. Padovan" <padovan@profusion.mobi>
Subject: [PATCH 2/5] serial: fix unref of dbus message
Date: Thu, 18 Aug 2011 17:10:00 -0300	[thread overview]
Message-ID: <1313698203-13201-2-git-send-email-padovan@profusion.mobi> (raw)
In-Reply-To: <1313698203-13201-1-git-send-email-padovan@profusion.mobi>

From: "Gustavo F. Padovan" <padovan@profusion.mobi>

port->msg needs unref when the reply is sent.
---
 serial/port.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/serial/port.c b/serial/port.c
index e359716..3f041a6 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -204,6 +204,11 @@ static void serial_port_free(void *data)
 
 	port_release(port);
 
+	if (port->msg) {
+		dbus_message_unref(port->msg);
+		port->msg = NULL;
+	}
+
 	g_free(port->uuid);
 	g_free(port);
 }
@@ -224,6 +229,11 @@ static void port_owner_exited(DBusConnection *conn, void *user_data)
 
 	port_release(port);
 
+	if (port->msg) {
+		dbus_message_unref(port->msg);
+		port->msg = NULL;
+	}
+
 	port->listener_id = 0;
 }
 
@@ -261,6 +271,8 @@ static void open_notify(int fd, int err, struct serial_port *port)
 
 	/* Reply to the requestor */
 	g_dbus_send_message(device->conn, reply);
+	dbus_message_unref(port->msg);
+	port->msg = NULL;
 }
 
 static gboolean open_continue(gpointer user_data)
@@ -339,6 +351,8 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *conn_err,
 				DBUS_TYPE_UNIX_FD, &sk,
 				DBUS_TYPE_INVALID);
 		g_dbus_send_message(device->conn, reply);
+		dbus_message_unref(port->msg);
+		port->msg = NULL;
 		return;
 	}
 
@@ -368,6 +382,8 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *conn_err,
 
 fail:
 	g_dbus_send_message(device->conn, reply);
+	dbus_message_unref(port->msg);
+	port->msg = NULL;
 	g_dbus_remove_watch(device->conn, port->listener_id);
 	port->listener_id = 0;
 }
@@ -431,6 +447,8 @@ failed:
 	g_dbus_remove_watch(device->conn, port->listener_id);
 	port->listener_id = 0;
 	g_dbus_send_message(device->conn, reply);
+	dbus_message_unref(port->msg);
+	port->msg = NULL;
 }
 
 static int connect_port(struct serial_port *port)
-- 
1.7.6


  reply	other threads:[~2011-08-18 20:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 20:09 [PATCH 1/5] serial: add Serial.ConnectFD() Gustavo F. Padovan
2011-08-18 20:10 ` Gustavo F. Padovan [this message]
2011-08-18 20:10   ` [PATCH 3/5] serial: use port->msg to track rfcomm connection procedure Gustavo F. Padovan
2011-08-18 20:10     ` [PATCH 4/5] serial: Add port->sender Gustavo F. Padovan
2011-08-18 20:10       ` [PATCH 5/5] serial: Add support to Disconnect fd passing connections Gustavo F. Padovan
2011-08-19  7:34         ` Luiz Augusto von Dentz
2011-08-19  7:20       ` [PATCH 4/5] serial: Add port->sender Luiz Augusto von Dentz
2011-08-19  7:13     ` [PATCH 3/5] serial: use port->msg to track rfcomm connection procedure Luiz Augusto von Dentz
2011-08-19 18:56       ` Gustavo Padovan
2011-08-19  7:07 ` [PATCH 1/5] serial: add Serial.ConnectFD() Luiz Augusto von Dentz
2011-08-19 18:49   ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313698203-13201-2-git-send-email-padovan@profusion.mobi \
    --to=padovan@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.