Linux bluetooth development
 help / color / mirror / Atom feed
From: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com,
	Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Subject: [PATCH] gdbus: Always unreference the message in g_dbus_send_message()
Date: Fri,  8 Feb 2013 15:58:10 +0200	[thread overview]
Message-ID: <1360331890-21983-1-git-send-email-tomasz.bursztyka@linux.intel.com> (raw)

---

Hi,

A quick fix on g_dbus_send_message(), if check_signal() fails it returns FALSE without unreferencing
the message as it should. This patch fixes it.

 gdbus/object.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 0c11246..ba8be94 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1496,7 +1496,7 @@ DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...)
 
 gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
 {
-	dbus_bool_t result;
+	dbus_bool_t result = FALSE;
 
 	if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
 		dbus_message_set_no_reply(message, TRUE);
@@ -1507,11 +1507,12 @@ gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
 		const GDBusArgInfo *args;
 
 		if (!check_signal(connection, path, interface, name, &args))
-			return FALSE;
+			goto out;
 	}
 
 	result = dbus_connection_send(connection, message, NULL);
 
+out:
 	dbus_message_unref(message);
 
 	return result;
-- 
1.8.1.2


             reply	other threads:[~2013-02-08 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 13:58 Tomasz Bursztyka [this message]
2013-02-23 10:48 ` [PATCH] gdbus: Always unreference the message in g_dbus_send_message() Johan Hedberg

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=1360331890-21983-1-git-send-email-tomasz.bursztyka@linux.intel.com \
    --to=tomasz.bursztyka@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox