Fix memory management issues 90/224990/3 accepted/tizen/unified/20200221.093534 submit/tizen/20200217.221032 submit/tizen/20200218.214546 submit/tizen/20200219.213751 submit/tizen/20200220.222107
authorArtur Świgoń <a.swigon@samsung.com>
Fri, 14 Feb 2020 11:12:04 +0000 (12:12 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 14 Feb 2020 12:05:36 +0000 (12:05 +0000)
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
atspi/atspi-mutter.c

index 6bab4c8..e7e7116 100644 (file)
@@ -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
         {
index 4445c18..532c1ab 100644 (file)
@@ -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