[at-spi2-atk] Don't leak strings



commit 1b1fa3c23337e39eba5adfbf689302a9163d4c01
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Sep 14 16:39:58 2012 -0400

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

 atk-adaptor/bridge.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index e3056e9..738c10b 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -249,7 +249,9 @@ register_reply (DBusPendingCall *pending, void *user_data)
           dbus_message_iter_next (&iter_struct);
           dbus_message_iter_get_basic (&iter_struct, &obj_path);
 
+          g_free (app->desktop_name);
           app->desktop_name = g_strdup (app_name);
+          g_free (app->desktop_path);
           app->desktop_path = g_strdup (obj_path);
         }
     }
@@ -275,8 +277,8 @@ register_application (SpiBridge * app)
 
   /* These will be overridden when we get a reply, but in practice these
      defaults should always be correct */
-  app->desktop_name = ATSPI_DBUS_NAME_REGISTRY;
-  app->desktop_path = ATSPI_DBUS_PATH_ROOT;
+  app->desktop_name = g_strdup (ATSPI_DBUS_NAME_REGISTRY);
+  app->desktop_path = g_strdup (ATSPI_DBUS_PATH_ROOT);
 
   message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
                                           ATSPI_DBUS_PATH_ROOT,
@@ -339,6 +341,11 @@ deregister_application (SpiBridge * app)
     g_free (app->app_tmp_dir);
     app->app_tmp_dir = NULL;
   }
+
+  g_free (app->desktop_name);
+  app->desktop_name = NULL;
+  g_free (app->desktop_path);
+  app->desktop_path = NULL;
 }
 
 /*---------------------------------------------------------------------------*/



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