dbus/dbus dbus-connection.c,1.76,1.77

Havoc Pennington hp at pdx.freedesktop.org
Fri Mar 26 21:29:33 PST 2004


Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv27130/dbus

Modified Files:
	dbus-connection.c 
Log Message:
2004-03-27  Havoc Pennington  <hp at 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
	


Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- a/dbus-connection.c	8 Mar 2004 10:59:20 -0000	1.76
+++ b/dbus-connection.c	27 Mar 2004 05:29:31 -0000	1.77
@@ -1749,20 +1749,15 @@
 
   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 @@
    * 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*




More information about the dbus-commit mailing list