[at-spi2-core] Fix an invalid free introduced in 2.39.90, along with some warnings
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Fix an invalid free introduced in 2.39.90, along with some warnings
- Date: Mon, 22 Feb 2021 18:29:52 +0000 (UTC)
commit 40e972450fc5ce928914a380e32b33129033d4da
Author: Mike Gorse <mgorse suse com>
Date: Mon Feb 22 12:31:15 2021 -0600
Fix an invalid free introduced in 2.39.90, along with some warnings
Fixes https://gitlab.gnome.org/GNOME/at-spi2-core/issues/30
atspi/atspi-accessible.c | 2 +-
atspi/atspi-event-listener.c | 5 +++--
atspi/atspi-misc.c | 7 +++----
3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 58d7316f..b078688c 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -418,7 +418,7 @@ atspi_accessible_get_parent (AtspiAccessible *obj, GError **error)
}
dbus_message_iter_init (reply, &iter);
dbus_message_iter_recurse (&iter, &iter_variant);
- g_object_unref (obj->accessible_parent);
+ g_clear_object (&obj->accessible_parent);
obj->accessible_parent = _atspi_dbus_return_accessible_from_iter (&iter_variant);
dbus_message_unref (reply);
_atspi_accessible_add_cache (obj, ATSPI_CACHE_PARENT);
diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c
index 00957dd1..ca6828fe 100644
--- a/atspi/atspi-event-listener.c
+++ b/atspi/atspi-event-listener.c
@@ -864,7 +864,8 @@ atspi_event_copy (AtspiEvent *src)
dst->detail2 = src->detail2;
g_value_init (&dst->any_data, G_VALUE_TYPE (&src->any_data));
g_value_copy (&src->any_data, &dst->any_data);
- dst->sender = g_object_ref (src->sender);
+ if (src->sender)
+ dst->sender = g_object_ref (src->sender);
return dst;
}
@@ -874,7 +875,7 @@ atspi_event_free (AtspiEvent *event)
g_object_unref (event->source);
g_free (event->type);
g_value_unset (&event->any_data);
- g_object_unref (event->sender);
+ g_clear_object (&event->sender);
g_free (event);
}
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index f897c7ea..7af46e9f 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -465,7 +465,8 @@ add_accessible_from_iter (DBusMessageIter *iter)
else
{
/* This place is already taken - let's free this place with dignity */
- g_object_unref (g_ptr_array_index (accessible->accessible_parent->children, index));
+ if (g_ptr_array_index (accessible->accessible_parent->children, index))
+ g_object_unref (g_ptr_array_index (accessible->accessible_parent->children, index));
}
g_ptr_array_index (accessible->accessible_parent->children, index) = g_object_ref (accessible);
}
@@ -1273,7 +1274,7 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name,
process_deferred_messages ();
if (!reply)
{
- // TODO: throw exception
+ /* TODO: throw exception */
goto done;
}
@@ -1300,14 +1301,12 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name,
}
if (!strcmp (type, "(so)"))
{
- g_object_unref (*(AtspiAccessible**)data);
*((AtspiAccessible **)data) = _atspi_dbus_return_accessible_from_iter (&iter_variant);
}
else
{
if (type [0] == 's')
{
- g_free (*(char**)data);
*(char**) data = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]