From 376e88a463ad9d1f5110808879b68d6bb0a50910 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Artur=20=C5=9Awigo=C5=84?= Date: Fri, 14 Feb 2020 12:12:04 +0100 Subject: [PATCH] Fix memory management issues atspi/atspi-mutter.c Dynamic memory referenced by 'name' was allocated at atspi-accessible.c:307 by calling function 'atspi_accessible_get_name' at atspi-mutter.c:398 and lost at atspi-mutter.c:401. Pointer '&data.rd_session_path[0]' returned from function 'g_strdup' at atspi-mutter.c:82 may be null, and it is dereferenced at atspi-mutter.c:83. atspi/atspi-event-listener.c Return value of a function '_atspi_dbus_return_accessible_from_iter' is dereferenced at atspi-event-listener.c:1094 without checking, but it is usually checked for this function (5/6). Change-Id: Ie311948f4d8f71025d0b1769a97e2904ee4af387 --- atspi/atspi-event-listener.c | 8 ++++++++ atspi/atspi-mutter.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c index 6bab4c8..e7e7116 100644 --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -1065,6 +1065,14 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message, void *data) if (!strcmp (category, "ScreenReader")) { e.source = accessible; + if (e.source == NULL) + { + g_warning ("Got no valid source accessible for signal %s from interface %s\n", member, category); + g_free (converted_type); + g_free (name); + g_free (detail); + return DBUS_HANDLER_RESULT_HANDLED; + } } else { diff --git a/atspi/atspi-mutter.c b/atspi/atspi-mutter.c index 4445c18..532c1ab 100644 --- a/atspi/atspi-mutter.c +++ b/atspi/atspi-mutter.c @@ -80,7 +80,7 @@ ensure_rd_session_path (GError **error) dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, MUTTER_REMOTE_DESKTOP_OBJECT_PATH, MUTTER_REMOTE_DESKTOP_INTERFACE, "CreateSession", &d_error, "=>o", &session_path); data.rd_session_path = g_strdup (session_path); - if (!data.rd_session_path[0]) + if (!data.rd_session_path || !data.rd_session_path[0]) return FALSE; dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "Start", &d_error, ""); @@ -398,6 +398,7 @@ _atspi_mutter_set_reference_window (AtspiAccessible *accessible) name = atspi_accessible_get_name (accessible, NULL); data.window_id = get_window_id (name); data.window_id_is_explicit = TRUE; + g_free(name); } else -- 2.7.4