at-spi r1105 - in trunk: . libspi



Author: liyuan
Date: Sat Sep 27 08:49:36 2008
New Revision: 1105
URL: http://svn.gnome.org/viewvc/at-spi?rev=1105&view=rev

Log:
2008-09-27  Li Yuan  <li yuan sun com>

        * libspi/accessible.c:
        (impl_accessibility_accessible_get_attributes):
        * libspi/document.c: (impl_getAttributes):
        * libspi/text.c: (impl_getAttributeRun),
        (impl_getDefaultAttributeSet):
        Bug #525519. Fix memory leak. Patch from Mike Gorse.


Modified:
   trunk/ChangeLog
   trunk/libspi/accessible.c
   trunk/libspi/document.c
   trunk/libspi/text.c

Modified: trunk/libspi/accessible.c
==============================================================================
--- trunk/libspi/accessible.c	(original)
+++ trunk/libspi/accessible.c	Sat Sep 27 08:49:36 2008
@@ -461,6 +461,7 @@
     gint i;
     
     AtkObject *object = get_atkobject_from_servant (servant);
+    gchar *concat_str;
     
     g_return_val_if_fail (object != NULL, NULL);
     attributes = atk_object_get_attributes (object);
@@ -476,7 +477,9 @@
     for (i = 0; i < n_attributes; ++i)
     {
 	attr = g_slist_nth_data (attributes, i);
-	retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
+	concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
+	retval->_buffer[i] = CORBA_string_dup (concat_str);
+	g_free (concat_str);
     }
 
     atk_attribute_set_free (attributes);

Modified: trunk/libspi/document.c
==============================================================================
--- trunk/libspi/document.c	(original)
+++ trunk/libspi/document.c	Sat Sep 27 08:49:36 2008
@@ -101,6 +101,7 @@
   Accessibility_AttributeSet *retval;
   gint n_attributes = 0;
   gint i;
+  gchar *concat_str;
   
   g_return_val_if_fail (document != NULL, NULL);
   
@@ -120,7 +121,9 @@
   for (i = 0; i < n_attributes; ++i)
   {
       attr = g_slist_nth_data (attributes, i);
-      retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
+      concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
+      retval->_buffer [i] = CORBA_string_dup (concat_str);
+      g_free (concat_str);
   }
     
   atk_attribute_set_free (attributes);

Modified: trunk/libspi/text.c
==============================================================================
--- trunk/libspi/text.c	(original)
+++ trunk/libspi/text.c	Sat Sep 27 08:49:36 2008
@@ -547,6 +547,7 @@
      AtkText *text = get_text_from_servant (servant);
      gint n_attributes = 0, total_attributes = 0, n_default_attributes = 0;
      gint i, j;
+     gchar *concat_str;
      
      g_return_val_if_fail (text != NULL, NULL);
 
@@ -576,13 +577,17 @@
 	 for (i = 0; i < n_attributes; ++i)
 	 {
 	     attr = g_slist_nth_data (attributes, i);
-	     retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
+             concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
+	     retval->_buffer[i] = CORBA_string_dup (concat_str);
+	     g_free (concat_str);
 	 }
 	 
 	 for (j = 0; j < n_default_attributes; ++i, ++j)
 	 {
 	     attr = g_slist_nth_data (default_attributes, j);
-	     retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
+	     concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
+	     retval->_buffer[i] = CORBA_string_dup (concat_str);
+	     g_free(concat_str);
 	 }
 	 
 	 atk_attribute_set_free (attributes);
@@ -601,6 +606,7 @@
      AtkText *text = get_text_from_servant (servant);
      gint n_attributes = 0;
      gint i;
+     gchar *concat_str;
      
      g_return_val_if_fail (text != NULL, NULL);
      
@@ -618,7 +624,9 @@
 	 for (i = 0; i < n_attributes; ++i)
 	 {
 	     attr = g_slist_nth_data (attributes, i);
-	     retval->_buffer [i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
+	     concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
+	     retval->_buffer [i] = CORBA_string_dup (concat_str);
+	     g_free (concat_str);
 	 }
 	 atk_attribute_set_free (attributes);
      }     



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