summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-connection.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-03-27 05:29:31 +0000
committerHavoc Pennington <hp@redhat.com>2004-03-27 05:29:31 +0000
commita221eefadfb48488129dedca2f2dc062e1c718e7 (patch)
tree37300627bdf5c2a5bda63ee86b9c00f64cd294da /dbus/dbus-connection.c
parent45277e93d8c8e18a04d1c28eb666337316726152 (diff)
2004-03-27 Havoc Pennington <hp@redhat.com>
Patch from Timo Teräs: * tools/dbus-send.c (main): if --print-reply, assume type is method call; support boolean type args * dbus/dbus-connection.c (dbus_connection_send_with_reply): fix a bunch of memleak and logic bugs
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r--dbus/dbus-connection.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index c9c09dfb..b65b541e 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -1749,20 +1749,15 @@ dbus_connection_send_with_reply (DBusConnection *connection,
reply = dbus_message_new_error (message, DBUS_ERROR_NO_REPLY,
"No reply within specified time");
- if (!reply)
- {
- CONNECTION_UNLOCK (connection);
- dbus_pending_call_unref (pending);
- return FALSE;
- }
+ if (reply == NULL)
+ goto error;
reply_link = _dbus_list_alloc_link (reply);
- if (!reply)
+ if (reply_link == NULL)
{
CONNECTION_UNLOCK (connection);
dbus_message_unref (reply);
- dbus_pending_call_unref (pending);
- return FALSE;
+ goto error_unlocked;
}
pending->timeout_link = reply_link;
@@ -1772,29 +1767,30 @@ dbus_connection_send_with_reply (DBusConnection *connection,
* Also, add the timeout.
*/
if (!_dbus_connection_attach_pending_call_unlocked (connection,
- pending))
- {
- CONNECTION_UNLOCK (connection);
- dbus_pending_call_unref (pending);
- return FALSE;
- }
+ pending))
+ goto error;
if (!_dbus_connection_send_unlocked (connection, message, NULL))
{
_dbus_connection_detach_pending_call_and_unlock (connection,
- pending);
- return FALSE;
+ pending);
+ goto error_unlocked;
}
if (pending_return)
- {
- dbus_pending_call_ref (pending);
- *pending_return = pending;
- }
+ *pending_return = pending;
+ else
+ dbus_pending_call_unref (pending);
CONNECTION_UNLOCK (connection);
return TRUE;
+
+ error:
+ CONNECTION_UNLOCK (connection);
+ error_unlocked:
+ dbus_pending_call_unref (pending);
+ return FALSE;
}
static DBusMessage*