[at-spi2-core] Fix memory leaks in get_toolkit_name and get_toolkit_version



commit b12cdda617ae1b3c45d7a553a96571736b7753bb
Author: Mike Gorse <mgorse novell com>
Date:   Thu May 5 19:39:33 2011 -0500

    Fix memory leaks in get_toolkit_name and get_toolkit_version
    
    _atspi_dbus_get_property calls g_strdup when it returns a string, so we
    should not g_strdup the result unless we're caching a copy for later use.

 atspi/atspi-accessible.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index a12967e..1085b72 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -760,7 +760,7 @@ atspi_accessible_get_toolkit_name (AtspiAccessible *obj, GError **error)
 
   if (!_atspi_dbus_get_property (obj, atspi_interface_application, "ToolkitName", error, "s", &ret))
       return NULL;
-  return g_strdup (ret);
+  return ret;
 }
 
 /**
@@ -782,7 +782,7 @@ atspi_accessible_get_toolkit_version (AtspiAccessible *obj, GError **error)
 
   if (!_atspi_dbus_get_property (obj, atspi_interface_application, "ToolkitVersion", error, "s", &ret))
       return NULL;
-  return g_strdup (ret);
+  return ret;
 }
 
 /**



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