socket-adaptor: fix memory leak
authorXan Lopez <xan@igalia.com>
Wed, 27 Mar 2013 20:40:12 +0000 (21:40 +0100)
committerMike Gorse <mgorse@suse.com>
Thu, 28 Mar 2013 10:30:04 +0000 (05:30 -0500)
Set a destructor for the object data. Other than fixing a leak this
also allows to simplify the code a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=696733

atk-adaptor/adaptors/socket-adaptor.c

index d7ebe5f..9aff7d7 100644 (file)
@@ -173,11 +173,8 @@ impl_Embedded (DBusConnection *bus,
     {
       return droute_invalid_arguments_error (message);
     }
-  id = g_object_get_data (G_OBJECT (object), "dbus-plug-parent");
-  if (id)
-    g_free (id);
   id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL);
-  g_object_set_data (G_OBJECT (object), "dbus-plug-parent", id);
+  g_object_set_data_full (G_OBJECT (object), "dbus-plug-parent", id, (GDestroyNotify)g_free);
 
   if (ATK_IS_COMPONENT (object))
     {