gdbus: Close private connection if setup fails
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 10 Apr 2015 12:54:37 +0000 (15:54 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 20 Apr 2015 07:04:39 +0000 (09:04 +0200)
Private connection should be properly closed with dbus_connection_close
otherwise libdbus exits with the following error:

  'The last reference on a connection was dropped without closing the
   connection. This is a bug in an application. See
   dbus_connection_unref() documentation for details. Most likely, the
   application was supposed to call dbus_connection_close(), since this
   is a private connection.'

gdbus/mainloop.c

index 3e88eac8627e4224b00790bfe61a78830e225be4..b90a8447c7066d1b01758df98c3fb18f57e8d70f 100644 (file)
@@ -322,6 +322,7 @@ DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
                return NULL;
 
        if (setup_bus(conn, name, error) == FALSE) {
+               dbus_connection_close(conn);
                dbus_connection_unref(conn);
                return NULL;
        }