[at-spi2-core] Don't leak errors



commit a7131e2fd668d7c6bf653d721bb0db052fc27393
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Sep 14 11:18:53 2012 -0400

    Don't leak errors
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684033

 atspi/atspi-accessible.c          |    6 +++-
 atspi/atspi-event-listener.c      |   20 ++++++-------
 atspi/atspi-misc.c                |   51 +++++++++++++++++++----------------
 atspi/atspi-registry.c            |   53 ++++++++++++++++++++++++++++++------
 bus/at-spi-bus-launcher.c         |   20 +++++++------
 dbind/dbind.c                     |   14 +++++----
 dbind/dbtest.c                    |    5 +---
 registryd/deviceeventcontroller.c |   47 +++++++++++++++++++--------------
 registryd/registry-main.c         |    7 +++--
 9 files changed, 136 insertions(+), 87 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index bf6b407..92f74e7 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -1523,7 +1523,11 @@ atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error)
   dbus_message_unref (message);
   dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID);
   dbus_message_unref (reply);
-  dbus_error_free (&d_error);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("GetConnectionUnixProcessID failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
   return pid;
 }
 
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index 2b0798e..6e70318 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -550,21 +550,22 @@ atspi_event_listener_register_from_callback (AtspiEventListenerCB callback,
     return FALSE;
   }
   event_listeners = g_list_prepend (event_listeners, e);
-  dbus_error_init (&d_error);
   for (i = 0; i < matchrule_array->len; i++)
   {
     char *matchrule = g_ptr_array_index (matchrule_array, i);
+    dbus_error_init (&d_error);
     dbus_bus_add_match (_atspi_bus(), matchrule, &d_error);
+    if (dbus_error_is_set (&d_error))
+      {
+        g_warning ("Atspi: Adding match: %s", d_error.message);
+        dbus_error_free (&d_error);
+        /* TODO: Set error */
+      }
+
     g_free (matchrule);
   }
   g_ptr_array_free (matchrule_array, TRUE);
-  if (d_error.message)
-  {
-    g_warning ("Atspi: Adding match: %s", d_error.message);
-    /* TODO: Set error */
-  }
 
-  dbus_error_init (&d_error);
   message = dbus_message_new_method_call (atspi_bus_registry,
 	atspi_path_registry,
 	atspi_interface_registry,
@@ -680,7 +681,6 @@ atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback,
         is_superset (detail, e->detail))
     {
       gboolean need_replace;
-      DBusError d_error;
       DBusMessage *message, *reply;
       need_replace = (l == event_listeners);
       l = g_list_remove (l, e);
@@ -689,10 +689,8 @@ atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback,
       for (i = 0; i < matchrule_array->len; i++)
       {
 	char *matchrule = g_ptr_array_index (matchrule_array, i);
-	dbus_error_init (&d_error);
-	dbus_bus_remove_match (_atspi_bus(), matchrule, &d_error);
+	dbus_bus_remove_match (_atspi_bus(), matchrule, NULL);
       }
-      dbus_error_init (&d_error);
       message = dbus_message_new_method_call (atspi_bus_registry,
 	    atspi_path_registry,
 	    atspi_interface_registry,
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 4cd3ed4..7578cb3 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -164,6 +164,11 @@ handle_get_bus_address (DBusPendingCall *pending, void *user_data)
           dbus_connection_unref (app->bus);
         app->bus = bus;
       }
+      else
+      {
+        g_warning ("Unable to open bus connection: %s", error.message);
+        dbus_error_free (&error);
+      }
     }
   }
   dbus_message_unref (reply);
@@ -187,7 +192,6 @@ get_application (const char *bus_name)
   AtspiApplication *app = NULL;
   char *bus_name_dup;
   DBusMessage *message;
-  DBusError error;
   DBusPendingCall *pending = NULL;
 
   if (!app_hash)
@@ -207,7 +211,6 @@ get_application (const char *bus_name)
   gettimeofday (&app->time_added, NULL);
   app->cache = ATSPI_CACHE_UNDEFINED;
   g_hash_table_insert (app_hash, bus_name_dup, app);
-  dbus_error_init (&error);
   message = dbus_message_new_method_call (bus_name, atspi_path_root,
                                           atspi_interface_application, "GetApplicationBusAddress");
 
@@ -318,9 +321,6 @@ handle_remove_accessible (DBusConnection *bus, DBusMessage *message, void *user_
 static gboolean
 add_app_to_desktop (AtspiAccessible *a, const char *bus_name)
 {
-  DBusError error;
-
-  dbus_error_init (&error);
   AtspiAccessible *obj = ref_accessible (bus_name, atspi_path_root);
   if (obj)
   {
@@ -329,7 +329,7 @@ add_app_to_desktop (AtspiAccessible *a, const char *bus_name)
   }
   else
   {
-    g_warning ("AT-SPI: Error calling getRoot for %s: %s", bus_name, error.message);
+    g_warning ("AT-SPI: Error calling getRoot for %s", bus_name);
   }
   return FALSE;
 }
@@ -506,7 +506,7 @@ handle_get_items (DBusPendingCall *pending, void *user_data)
 static AtspiAccessible *
 ref_accessible_desktop (AtspiApplication *app)
 {
-  DBusError error;
+  GError *error;
   DBusMessage *message, *reply;
   DBusMessageIter iter, iter_array;
   gchar *bus_name_dup;
@@ -524,17 +524,21 @@ ref_accessible_desktop (AtspiApplication *app)
   g_hash_table_insert (app->hash, desktop->parent.path, desktop);
   g_object_ref (desktop);	/* for the hash */
   desktop->name = g_strdup ("main");
-  dbus_error_init (&error);
   message = dbus_message_new_method_call (atspi_bus_registry,
 	atspi_path_root,
 	atspi_interface_accessible,
 	"GetChildren");
   if (!message)
     return NULL;
-  reply = _atspi_dbus_send_with_reply_and_block (message, NULL);
+  error = NULL;
+  reply = _atspi_dbus_send_with_reply_and_block (message, &error);
   if (!reply || strcmp (dbus_message_get_signature (reply), "a(so)") != 0)
   {
-    g_warning ("Couldn't get application list: %s", error.message);
+    if (error != NULL)
+    {
+      g_warning ("Couldn't get application list: %s", error->message);
+      g_clear_error (&error);
+    }
     if (reply)
       dbus_message_unref (reply);
     return NULL;
@@ -816,7 +820,6 @@ spi_display_name (void)
 int
 atspi_init (void)
 {
-  DBusError error;
   char *match;
   const gchar *no_cache;
 
@@ -831,28 +834,26 @@ atspi_init (void)
 
   get_live_refs();
 
-  dbus_error_init (&error);
   bus = atspi_get_a11y_bus ();
   if (!bus)
     return 2;
-  dbus_bus_register (bus, &error);
+  dbus_bus_register (bus, NULL);
   atspi_dbus_connection_setup_with_g_main(bus, g_main_context_default());
   dbus_connection_add_filter (bus, atspi_dbus_filter, NULL, NULL);
   match = g_strdup_printf ("type='signal',interface='%s',member='AddAccessible'", atspi_interface_cache);
-  dbus_error_init (&error);
-  dbus_bus_add_match (bus, match, &error);
+  dbus_bus_add_match (bus, match, NULL);
   g_free (match);
   match = g_strdup_printf ("type='signal',interface='%s',member='RemoveAccessible'", atspi_interface_cache);
-  dbus_bus_add_match (bus, match, &error);
+  dbus_bus_add_match (bus, match, NULL);
   g_free (match);
   match = g_strdup_printf ("type='signal',interface='%s',member='ChildrenChanged'", atspi_interface_event_object);
-  dbus_bus_add_match (bus, match, &error);
+  dbus_bus_add_match (bus, match, NULL);
   g_free (match);
   match = g_strdup_printf ("type='signal',interface='%s',member='PropertyChange'", atspi_interface_event_object);
-  dbus_bus_add_match (bus, match, &error);
+  dbus_bus_add_match (bus, match, NULL);
   g_free (match);
   match = g_strdup_printf ("type='signal',interface='%s',member='StateChanged'", atspi_interface_event_object);
-  dbus_bus_add_match (bus, match, &error);
+  dbus_bus_add_match (bus, match, NULL);
   g_free (match);
 
   no_cache = g_getenv ("ATSPI_NO_CACHE");
@@ -1139,10 +1140,10 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name,
 
   if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
   {
-    const char *err = NULL;
-    dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
-    if (err)
-      g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err);
+    const char *err_str = NULL;
+    dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID);
+    if (err_str)
+      g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err_str);
     goto done;
   }
 
@@ -1195,7 +1196,7 @@ _atspi_dbus_send_with_reply_and_block (DBusMessage *message, GError **error)
   reply = dbind_send_and_allow_reentry (bus, message, &err);
   _atspi_process_deferred_messages ((gpointer)TRUE);
   dbus_message_unref (message);
-  if (err.message)
+  if (dbus_error_is_set (&err))
   {
     if (error)
       g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err.message);
@@ -1448,6 +1449,7 @@ atspi_get_a11y_bus (void)
   if (!bus)
     {
       g_warning ("Couldn't connect to accessibility bus: %s", error.message);
+      dbus_error_free (&error);
       return NULL;
     }
   else
@@ -1455,6 +1457,7 @@ atspi_get_a11y_bus (void)
       if (!dbus_bus_register (bus, &error))
 	{
 	  g_warning ("Couldn't register with accessibility bus: %s", error.message);
+          dbus_error_free (&error);
 	  return NULL;
 	}
     }
diff --git a/atspi/atspi-registry.c b/atspi/atspi-registry.c
index 26a3ca2..c54a6f9 100644
--- a/atspi/atspi-registry.c
+++ b/atspi/atspi-registry.c
@@ -171,8 +171,13 @@ atspi_register_keystroke_listener (AtspiDeviceListener  *listener,
   listener_mode.global =
 	  (dbus_bool_t) ((sync_type & ATSPI_KEYLISTENER_ALL_WINDOWS)!=0);
 
-    dbus_error_init (&d_error);
-    dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "RegisterKeystrokeListener", &d_error, "oa(iisi)uu(bbb)=>b", path, d_key_set, d_modmask, d_event_types, &listener_mode, &retval);
+  dbus_error_init (&d_error);
+  dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "RegisterKeystrokeListener", &d_error, "oa(iisi)uu(bbb)=>b", path, d_key_set, d_modmask, d_event_types, &listener_mode, &retval);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("RegisterKeystrokeListener failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
 
   g_array_free (d_key_set, TRUE);
   g_free (path);
@@ -250,6 +255,12 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener,
                                "DeregisterKeystrokeListener", &d_error,
                                "oa(iisi)uu", path, d_key_set, d_modmask,
                                d_event_types);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("DeregisterKeystrokeListener failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
+
   g_array_free (d_key_set, TRUE);
   g_free (path);
   return TRUE;
@@ -284,6 +295,12 @@ atspi_register_device_event_listener (AtspiDeviceListener  *listener,
     }
 
     dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "RegisterDeviceEventListener", &d_error, "ou=>b", path, d_event_types, &retval);
+    if (dbus_error_is_set (&d_error))
+      {
+        g_warning ("RegisterDeviceEventListener failed: %s", d_error.message);
+        dbus_error_free (&d_error);
+      }
+
   g_free (path);
   return retval;
 }
@@ -317,7 +334,13 @@ atspi_deregister_device_event_listener (AtspiDeviceListener *listener,
   event_types |= (1 << ATSPI_BUTTON_PRESSED_EVENT);
   event_types |= (1 << ATSPI_BUTTON_RELEASED_EVENT);
 
-    dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "DeregisterDeviceEventListener", &d_error, "ou", path, event_types);
+  dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "DeregisterDeviceEventListener", &d_error, "ou", path, event_types);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("DeregisterDeviceEventListener failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
+
   g_free (path);
   return TRUE;
 }
@@ -351,8 +374,14 @@ atspi_generate_keyboard_event (glong keyval,
   DBusError d_error;
 
   dbus_error_init (&d_error);
-  if (!keystring) keystring = "";
-    dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "GenerateKeyboardEvent", &d_error, "isu", d_keyval, keystring, d_synth_type);
+  if (!keystring)
+    keystring = "";
+  dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "GenerateKeyboardEvent", &d_error, "isu", d_keyval, keystring, d_synth_type);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("GenerateKeyboardEvent failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
 
   return TRUE;
 }
@@ -380,10 +409,16 @@ atspi_generate_mouse_event (glong x, glong y, const gchar *name, GError **error)
   DBusError d_error;
 
   dbus_error_init (&d_error);
-    dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry,
-                                 atspi_path_dec, atspi_interface_dec,
-                                 "GenerateMouseEvent", &d_error, "iis",
-                                 d_x, d_y, name);
+  dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry,
+                               atspi_path_dec, atspi_interface_dec,
+                               "GenerateMouseEvent", &d_error, "iis",
+                               d_x, d_y, name);
+  if (dbus_error_is_set (&d_error))
+    {
+      g_warning ("GenerateMouseEvent failed: %s", d_error.message);
+      dbus_error_free (&d_error);
+    }
+
   return TRUE;
 }
 
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index a60b70e..ec506f5 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -417,15 +417,18 @@ on_bus_acquired (GDBusConnection *connection,
                                                        NULL,
                                                        &error);
   if (registration_id == 0)
-    g_error ("%s", error->message);
+    {
+      g_error ("%s", error->message);
+      g_clear_error (&error);
+    }
 
   g_dbus_connection_register_object (connection,
-                                                       "/org/a11y/bus",
-                                                       introspection_data->interfaces[1],
-                                                       &status_vtable,
-                                                       _global_app,
-                                                       NULL,
-                                                       &error);
+                                     "/org/a11y/bus",
+                                     introspection_data->interfaces[1],
+                                     &status_vtable,
+                                     _global_app,
+                                     NULL,
+                                     NULL);
 }
 
 static void
@@ -513,11 +516,10 @@ already_running ()
   if (data)
   {
     GDBusConnection *bus;
-    GError *error = NULL;
     const gchar *old_session = g_getenv ("DBUS_SESSION_BUS_ADDRESS");
     /* TODO: Is there a better way to connect? This is really hacky */
     g_setenv ("DBUS_SESSION_BUS_ADDRESS", data, TRUE);
-    bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+    bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
     g_setenv ("DBUS_SESSION_BUS_ADDRESS", old_session, TRUE);
     if (bus != NULL)
       {
diff --git a/dbind/dbind.c b/dbind/dbind.c
index f216c52..a463308 100644
--- a/dbind/dbind.c
+++ b/dbind/dbind.c
@@ -123,11 +123,12 @@ dbind_method_call_reentrant_va (DBusConnection *cnx,
     const char *p;
   va_list args_demarshal;
 
+  dbus_error_init (&real_err);
+
   va_copy (args_demarshal, args);
     if (opt_error)
         err = opt_error;
     else {
-        dbus_error_init (&real_err);
         err = &real_err;
     }
 
@@ -176,8 +177,8 @@ out:
     if (reply)
         dbus_message_unref (reply);
 
-    if (err == &real_err)
-        dbus_error_free (err);
+    if (dbus_error_is_set (&real_err))
+        dbus_error_free (&real_err);
 
     va_end (args_demarshal);
     return success;
@@ -244,10 +245,11 @@ dbind_emit_signal_va (DBusConnection *cnx,
     DBusError *err, real_err;
     const char *p;
 
+    dbus_error_init (&real_err);
+
     if (opt_error)
         err = opt_error;
     else {
-        dbus_error_init (&real_err);
         err = &real_err;
     }
 
@@ -268,8 +270,8 @@ out:
     if (msg)
         dbus_message_unref (msg);
 
-    if (err == &real_err)
-        dbus_error_free (err);
+    if (dbus_error_is_set (&real_err))
+        dbus_error_free (&real_err);
 
     return success;
 }
diff --git a/dbind/dbtest.c b/dbind/dbtest.c
index e8bbb63..abd241a 100644
--- a/dbind/dbtest.c
+++ b/dbind/dbtest.c
@@ -409,11 +409,8 @@ void test_helpers ()
 int main (int argc, char **argv)
 {
     DBusConnection *bus;
-    DBusError err;
 
-    dbus_error_init (&err);
-
-    bus = dbus_bus_get (DBUS_BUS_SESSION, &err);
+    bus = dbus_bus_get (DBUS_BUS_SESSION, NULL);
 
     test_helpers ();
     test_marshalling ();
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 61ab91d..b8c1bc7 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -200,7 +200,15 @@ spi_dbus_add_disconnect_match (DBusConnection *bus, const char *name)
     dbus_error_init (&error);
     dbus_bus_add_match (bus, match, &error);
     g_free (match);
-    return !dbus_error_is_set (&error);
+    if (dbus_error_is_set (&error))
+      {
+        dbus_error_free (&error);
+        return FALSE;
+      }
+    else
+      {
+        return TRUE;
+      }
   }
   else return FALSE;
 }
@@ -215,7 +223,15 @@ spi_dbus_remove_disconnect_match (DBusConnection *bus, const char *name)
     dbus_error_init (&error);
     dbus_bus_remove_match (bus, match, &error);
     g_free (match);
-    return !dbus_error_is_set (&error);
+    if (dbus_error_is_set (&error))
+      {
+        dbus_error_free (&error);
+        return FALSE;
+      }
+    else
+      {
+        return TRUE;
+      }
   }
   else return FALSE;
 }
@@ -1253,7 +1269,6 @@ Accessibility_DeviceEventListener_NotifyEvent(SpiDEController *controller,
                                                       listener->path,
                                                       SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER,
                                                       "NotifyEvent");
-  DBusError error;
   dbus_bool_t consumed = FALSE;
   GSList *l;
   gboolean hung = FALSE;
@@ -1268,21 +1283,21 @@ Accessibility_DeviceEventListener_NotifyEvent(SpiDEController *controller,
     }
   }
 
-  dbus_error_init(&error);
   if (spi_dbus_marshal_deviceEvent(message, key_event))
   {
+    DBusMessage *reply;
+
     if (hung)
     {
       dbus_connection_send (controller->bus, message, NULL);
       dbus_message_unref (message);
       return FALSE;
     }
-    DBusMessage *reply = send_and_allow_reentry (controller->bus, message, 3000, &error);
+
+    reply = send_and_allow_reentry (controller->bus, message, 3000, NULL);
     if (reply)
     {
-      DBusError error;
-      dbus_error_init(&error);
-      dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &consumed, DBUS_TYPE_INVALID);
+      dbus_message_get_args(reply, NULL, DBUS_TYPE_BOOLEAN, &consumed, DBUS_TYPE_INVALID);
       dbus_message_unref(reply);
     }
   }
@@ -2185,14 +2200,12 @@ impl_register_device_event_listener (DBusConnection *bus,
 {
   SpiDEController *controller = SPI_DEVICE_EVENT_CONTROLLER(user_data);
   DEControllerListener *dec_listener;
-  DBusError error;
   const char *path;
   dbus_int32_t event_types;
   dbus_bool_t ret;
   DBusMessage *reply = NULL;
 
-  dbus_error_init(&error);
-  if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
+  if (!dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
   {
     return invalid_arguments_error (message);
   }
@@ -2384,13 +2397,11 @@ impl_deregister_device_event_listener (DBusConnection *bus,
 {
   SpiDEController *controller = SPI_DEVICE_EVENT_CONTROLLER(user_data);
   DEControllerListener *listener;
-  DBusError error;
   const char *path;
   dbus_int32_t event_types;
   DBusMessage *reply = NULL;
 
-  dbus_error_init(&error);
-  if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
+  if (!dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_UINT32, &event_types, DBUS_TYPE_INVALID))
   {
     return invalid_arguments_error (message);
   }
@@ -2741,7 +2752,6 @@ dec_synth_keystring (SpiDEController *controller, const char *keystring)
 static DBusMessage * impl_generate_keyboard_event (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
   SpiDEController *controller = SPI_DEVICE_EVENT_CONTROLLER(user_data);
-  DBusError error;
   dbus_int32_t keycode;
   char *keystring;
   dbus_uint32_t synth_type;
@@ -2750,8 +2760,7 @@ static DBusMessage * impl_generate_keyboard_event (DBusConnection *bus, DBusMess
   DEControllerPrivateData *priv;
   DBusMessage *reply = NULL;
 
-  dbus_error_init(&error);
-  if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32, &keycode, DBUS_TYPE_STRING, &keystring, DBUS_TYPE_UINT32, &synth_type, DBUS_TYPE_INVALID))
+  if (!dbus_message_get_args(message, NULL, DBUS_TYPE_INT32, &keycode, DBUS_TYPE_STRING, &keystring, DBUS_TYPE_UINT32, &synth_type, DBUS_TYPE_INVALID))
   {
     return invalid_arguments_error (message);
   }
@@ -2820,7 +2829,6 @@ static DBusMessage * impl_generate_keyboard_event (DBusConnection *bus, DBusMess
 /* Accessibility::DEController::GenerateMouseEvent */
 static DBusMessage * impl_generate_mouse_event (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
-  DBusError error;
   dbus_int32_t       x;
   dbus_int32_t       y;
   char *eventName;
@@ -2829,8 +2837,7 @@ static DBusMessage * impl_generate_mouse_event (DBusConnection *bus, DBusMessage
   gboolean err = FALSE;
   Display *display = spi_get_display ();
 
-  dbus_error_init (&error);
-  if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_STRING, &eventName, DBUS_TYPE_INVALID))
+  if (!dbus_message_get_args(message, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_STRING, &eventName, DBUS_TYPE_INVALID))
   {
     return invalid_arguments_error (message);
   }
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index c58929d..2ba9f4c 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -197,7 +197,6 @@ main (int argc, char **argv)
   GOptionContext *opt;
 
   GError *err = NULL;
-  DBusError error;
   int ret;
 
   g_type_init();
@@ -207,12 +206,14 @@ main (int argc, char **argv)
   g_option_context_add_main_entries(opt, optentries, NULL);
 
   if (!g_option_context_parse(opt, &argc, &argv, &err))
+    {
       g_error("Option parsing failed: %s\n", err->message);
+      g_clear_error (&err);
+    }
 
   if (dbus_name == NULL)
       dbus_name = SPI_DBUS_NAME_REGISTRY;
 
-  dbus_error_init (&error);
   bus = atspi_get_a11y_bus ();
   if (!bus)
   {
@@ -222,7 +223,7 @@ main (int argc, char **argv)
   mainloop = g_main_loop_new (NULL, FALSE);
   atspi_dbus_connection_setup_with_g_main(bus, NULL);
 
-  ret = dbus_bus_request_name(bus, dbus_name, DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
+  ret = dbus_bus_request_name(bus, dbus_name, DBUS_NAME_FLAG_DO_NOT_QUEUE, NULL);
   if (ret == DBUS_REQUEST_NAME_REPLY_EXISTS)
     {
       exit (0);	/* most likely already running */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]