[at-spi2-core] atspi_accessible_get_(name|description): fix memory leak
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] atspi_accessible_get_(name|description): fix memory leak
- Date: Mon, 22 Feb 2021 21:51:32 +0000 (UTC)
commit edc59b4d0fbc37cd7763109167f50f42bb50edca
Author: Mike Gorse <mgorse suse com>
Date: Mon Feb 22 15:53:35 2021 -0600
atspi_accessible_get_(name|description): fix memory leak
This is likely what the backed-out part of !53 was trying to do.
atspi/atspi-accessible.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index b078688c..ab1267aa 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -340,8 +340,12 @@ gchar *
atspi_accessible_get_name (AtspiAccessible *obj, GError **error)
{
g_return_val_if_fail (obj != NULL, g_strdup (""));
+
if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_NAME))
{
+if (obj->name) printf("free\n");
+ g_free (obj->name);
+ obj->name = NULL;
if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, "Name", error,
"s", &obj->name))
return g_strdup ("");
@@ -366,6 +370,8 @@ atspi_accessible_get_description (AtspiAccessible *obj, GError **error)
if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_DESCRIPTION))
{
+ g_free (obj->description);
+ obj->description = NULL;
if (!_atspi_dbus_get_property (obj, atspi_interface_accessible,
"Description", error, "s",
&obj->description))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]