[at-spi2-core] Fix a few memory leaks in at-spi2-registryd



commit 6d69cbb7fce5405e0459aeae56aad284830924af
Author: jhbuild <jhbuild linux-5itg site>
Date:   Mon Feb 21 00:09:34 2011 -0600

    Fix a few memory leaks in at-spi2-registryd

 registryd/deviceeventcontroller.c |    9 ++++++++-
 registryd/registry-main.c         |    2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 3e82469..674679d 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -837,6 +837,8 @@ spi_key_listener_data_free (DEControllerKeyListener *key_listener)
 {
   keylist_free(key_listener->keys);
   if (key_listener->mode) g_free(key_listener->mode);
+  g_free (key_listener->listener.bus_name);
+  g_free (key_listener->listener.path);
   g_free (key_listener);
 }
 
@@ -1034,6 +1036,7 @@ send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, int timeout,
       if (!dbus_connection_read_write_dispatch (bus, timeout))
         return NULL;
     }
+    dbus_pending_call_unref (pending);
     return reply;
 }
 static gboolean
@@ -1905,6 +1908,7 @@ impl_register_keystroke_listener (DBusConnection *bus,
   dbus_bool_t ret;
   DBusMessage *reply = NULL;
   char *keystring;
+  char *sig;
 
   dbus_message_iter_init(message, &iter);
   // TODO: verify type signature
@@ -1924,7 +1928,8 @@ impl_register_keystroke_listener (DBusConnection *bus,
   dbus_message_iter_next(&iter);
   dbus_message_iter_get_basic(&iter, &mask);
   dbus_message_iter_next(&iter);
-  if (!strcmp (dbus_message_iter_get_signature (&iter), "u"))
+  sig = dbus_message_iter_get_signature (&iter);
+  if (sig && !strcmp (sig, "u"))
     dbus_message_iter_get_basic(&iter, &type);
   else
   {
@@ -1938,6 +1943,7 @@ impl_register_keystroke_listener (DBusConnection *bus,
     }
     dbus_message_iter_next (&iter_array);
   }
+  dbus_free (sig);
   dbus_message_iter_next(&iter);
   mode = (Accessibility_EventListenerMode *)g_malloc(sizeof(Accessibility_EventListenerMode));
   if (mode)
@@ -1949,6 +1955,7 @@ impl_register_keystroke_listener (DBusConnection *bus,
 	   dbus_message_get_sender(message), path, (unsigned long) mask);
 #endif
   dec_listener = spi_dec_key_listener_new (dbus_message_get_sender(message), path, keys, mask, type, mode);
+  g_free (mode);
   ret = spi_controller_register_device_listener (
 	  controller, (DEControllerListener *) dec_listener);
   reply = dbus_message_new_method_return (message);
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index 403f420..b1b5cde 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -260,6 +260,7 @@ spi_get_bus (void)
      else
      {
 	 bus = dbus_connection_open (data, &error);
+	 XFree (data);
          if (!bus)
          {
              g_error ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
@@ -271,6 +272,7 @@ spi_get_bus (void)
          } 
      }
 
+  XCloseDisplay (bridge_display);
      return bus;
 }
 



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