From f0c92646eb4e5a2d11a477af16b7bd8cdf2f70d2 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 13:53:08 +0100 Subject: [PATCH 1/6] wayland/surface: Plug leak in meta_wayland_surface_assign_role The underlying data of the names array is not used anymore after this, so it should be freed as well. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/wayland/meta-wayland-surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 74e134fb6dc..c991d65535c 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -206,7 +206,7 @@ meta_wayland_surface_assign_role (MetaWaylandSurface *surface, (const GValue *) values->data); surface->role = META_WAYLAND_SURFACE_ROLE (role_object); - g_array_free (names, FALSE); + g_array_free (names, TRUE); g_array_free (values, TRUE); } else -- GitLab From 51733ca4996f128b2701258411f0cc5cf00830a4 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 14:00:33 +0100 Subject: [PATCH 2/6] window/wayland: Plug window configuration leak The acked configuration is removed from the pending configuration list by acquire_acked_configuration(), but finish_move_resize() does not free the data after applying the configuration. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/wayland/meta-window-wayland.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index 5a73de4c4a8..7c8bcff42a6 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -864,6 +864,8 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, gravity = meta_resize_gravity_from_grab_op (window->display->grab_op); meta_window_move_resize_internal (window, flags, gravity, rect); + + g_clear_pointer (&acked_configuration, meta_wayland_window_configuration_free); } void -- GitLab From 9feda1c58bfaa7573fa955351ecc537709b80055 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 18:46:20 +0100 Subject: [PATCH 3/6] kms/crtc: Fix gamma state leak The gamma value pointers of the current_state are overwritten by the calls to memdup causing a small leak. while the leak itself is small, it can be triggered quite often from things like night light. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/backends/native/meta-kms-crtc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c index da99a58cd2e..6cf75249493 100644 --- a/src/backends/native/meta-kms-crtc.c +++ b/src/backends/native/meta-kms-crtc.c @@ -203,6 +203,7 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, if (gamma->crtc != crtc) continue; + clear_gamma_state (crtc); crtc->current_state.gamma.size = gamma->size; crtc->current_state.gamma.red = g_memdup (gamma->red, gamma->size * sizeof (uint16_t)); -- GitLab From a63e80ec64be268c2ed9883dd871aeaab39de9e5 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 18:47:43 +0100 Subject: [PATCH 4/6] wayland: Avoid GVariant leak in set_gnome_env https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/wayland/meta-wayland.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index 806c897c983..876b4925aa2 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -266,13 +266,14 @@ set_gnome_env (const char *name, { GDBusConnection *session_bus; GError *error = NULL; + g_autoptr (GVariant) result = NULL; setenv (name, value, TRUE); session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_assert (session_bus); - g_dbus_connection_call_sync (session_bus, + result = g_dbus_connection_call_sync (session_bus, "org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", -- GitLab From 66fe6d85d011933eaa6fb021f9d827685e8381ac Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 18:49:13 +0100 Subject: [PATCH 5/6] backends/crtc: Fix leak of MetaCrtcMode name string https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/backends/meta-crtc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backends/meta-crtc.c b/src/backends/meta-crtc.c index 7ca31ba399d..85424c5756b 100644 --- a/src/backends/meta-crtc.c +++ b/src/backends/meta-crtc.c @@ -63,6 +63,8 @@ meta_crtc_mode_finalize (GObject *object) if (crtc_mode->driver_notify) crtc_mode->driver_notify (crtc_mode); + g_clear_pointer (&crtc_mode->name, g_free); + G_OBJECT_CLASS (meta_crtc_mode_parent_class)->finalize (object); } -- GitLab From abc58f7b9d591f4b9f62b3536938a9ab57137a76 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 24 Jan 2020 18:51:03 +0100 Subject: [PATCH 6/6] kms: Fix drmModeEncoder leak The result of drmModeGetEncoder() needs to be free'd by the caller. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020 --- src/backends/native/meta-kms-connector.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c index c018a5e62e1..ce8d28ae078 100644 --- a/src/backends/native/meta-kms-connector.c +++ b/src/backends/native/meta-kms-connector.c @@ -381,8 +381,11 @@ set_encoder_device_idx_bit (uint32_t *encoder_device_idxs, if (drm_encoder->encoder_id == encoder_id) { *encoder_device_idxs |= (1 << i); + drmModeFreeEncoder (drm_encoder); break; } + + drmModeFreeEncoder (drm_encoder); } } @@ -421,6 +424,8 @@ state_set_crtc_state (MetaKmsConnectorState *state, if (drm_connector->encoder_id == drm_encoder->encoder_id) state->current_crtc_id = drm_encoder->crtc_id; + + drmModeFreeEncoder (drm_encoder); } state->common_possible_crtcs = common_possible_crtcs; -- GitLab